Commit 2c8dd116 authored by Denis V. Lunev's avatar Denis V. Lunev Committed by David S. Miller

[XFRM]: Compilation warnings in xfrm_user.c.

When CONFIG_SECURITY_NETWORK_XFRM is undefined the following warnings appears:
net/xfrm/xfrm_user.c: In function 'xfrm_add_pol_expire':
net/xfrm/xfrm_user.c:1576: warning: 'ctx' may be used uninitialized in this function
net/xfrm/xfrm_user.c: In function 'xfrm_get_policy':
net/xfrm/xfrm_user.c:1340: warning: 'ctx' may be used uninitialized in this function
(security_xfrm_policy_alloc is noop for the case).

It seems that they are result of the commit
03e1ad7b ("LSM: Make the Labeled IPsec
hooks more stack friendly")
Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 569508c9
...@@ -1343,14 +1343,14 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -1343,14 +1343,14 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
if (err) if (err)
return err; return err;
ctx = NULL;
if (rt) { if (rt) {
struct xfrm_user_sec_ctx *uctx = nla_data(rt); struct xfrm_user_sec_ctx *uctx = nla_data(rt);
err = security_xfrm_policy_alloc(&ctx, uctx); err = security_xfrm_policy_alloc(&ctx, uctx);
if (err) if (err)
return err; return err;
} else }
ctx = NULL;
xp = xfrm_policy_bysel_ctx(type, p->dir, &p->sel, ctx, xp = xfrm_policy_bysel_ctx(type, p->dir, &p->sel, ctx,
delete, &err); delete, &err);
security_xfrm_policy_free(ctx); security_xfrm_policy_free(ctx);
...@@ -1579,14 +1579,14 @@ static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -1579,14 +1579,14 @@ static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh,
if (err) if (err)
return err; return err;
ctx = NULL;
if (rt) { if (rt) {
struct xfrm_user_sec_ctx *uctx = nla_data(rt); struct xfrm_user_sec_ctx *uctx = nla_data(rt);
err = security_xfrm_policy_alloc(&ctx, uctx); err = security_xfrm_policy_alloc(&ctx, uctx);
if (err) if (err)
return err; return err;
} else }
ctx = NULL;
xp = xfrm_policy_bysel_ctx(type, p->dir, &p->sel, ctx, 0, &err); xp = xfrm_policy_bysel_ctx(type, p->dir, &p->sel, ctx, 0, &err);
security_xfrm_policy_free(ctx); security_xfrm_policy_free(ctx);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment