xfrm: a few coding style clean ups

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
This commit is contained in:
Sabrina Dubroca 2022-11-24 15:43:38 +01:00 коммит произвёл Steffen Klassert
Родитель cc2bbbfd9a
Коммит f157c416c5
2 изменённых файлов: 9 добавлений и 6 удалений

Просмотреть файл

@ -4414,7 +4414,8 @@ int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
struct xfrm_migrate *mp; struct xfrm_migrate *mp;
/* Stage 0 - sanity checks */ /* Stage 0 - sanity checks */
if ((err = xfrm_migrate_check(m, num_migrate)) < 0) err = xfrm_migrate_check(m, num_migrate);
if (err < 0)
goto out; goto out;
if (dir >= XFRM_POLICY_MAX) { if (dir >= XFRM_POLICY_MAX) {
@ -4423,7 +4424,8 @@ int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
} }
/* Stage 1 - find policy */ /* Stage 1 - find policy */
if ((pol = xfrm_migrate_policy_find(sel, dir, type, net, if_id)) == NULL) { pol = xfrm_migrate_policy_find(sel, dir, type, net, if_id);
if (!pol) {
err = -ENOENT; err = -ENOENT;
goto out; goto out;
} }
@ -4445,7 +4447,8 @@ int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
} }
/* Stage 3 - update policy */ /* Stage 3 - update policy */
if ((err = xfrm_policy_migrate(pol, m, num_migrate)) < 0) err = xfrm_policy_migrate(pol, m, num_migrate);
if (err < 0)
goto restore_state; goto restore_state;
/* Stage 4 - delete old state(s) */ /* Stage 4 - delete old state(s) */

Просмотреть файл

@ -1538,7 +1538,7 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh,
&p->info.saddr, 1, &p->info.saddr, 1,
family); family);
err = -ENOENT; err = -ENOENT;
if (x == NULL) if (!x)
goto out_noput; goto out_noput;
err = xfrm_alloc_spi(x, p->min, p->max); err = xfrm_alloc_spi(x, p->min, p->max);
@ -2718,7 +2718,7 @@ static int xfrm_do_migrate(struct sk_buff *skb, struct nlmsghdr *nlh,
struct xfrm_encap_tmpl *encap = NULL; struct xfrm_encap_tmpl *encap = NULL;
u32 if_id = 0; u32 if_id = 0;
if (attrs[XFRMA_MIGRATE] == NULL) if (!attrs[XFRMA_MIGRATE])
return -EINVAL; return -EINVAL;
kmp = attrs[XFRMA_KMADDRESS] ? &km : NULL; kmp = attrs[XFRMA_KMADDRESS] ? &km : NULL;
@ -2727,7 +2727,7 @@ static int xfrm_do_migrate(struct sk_buff *skb, struct nlmsghdr *nlh,
if (err) if (err)
return err; return err;
err = copy_from_user_migrate((struct xfrm_migrate *)m, kmp, attrs, &n); err = copy_from_user_migrate(m, kmp, attrs, &n);
if (err) if (err)
return err; return err;