: Compilation warnings in xfrm_user.c.
Subsystems (3)
PATCH 1/1 : 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 commit03e1ad7b5d871d4189b1da3125c2f12d1b5f7d0b
--- net/xfrm/xfrm_user.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
net/xfrm/xfrm_user.c +4 -4
@@ -1343,14 +1343,14 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh,if (err)return err; + ctx =NULL ;if (rt) {struct xfrm_user_sec_ctx *uctx =nla_data (rt); err =security_xfrm_policy_alloc (&ctx, uctx);if (err)return err; - }else - ctx =NULL ; + } xp =xfrm_policy_bysel_ctx (type, p->dir, &p->sel, ctx, delete, &err);security_xfrm_policy_free (ctx);
@@ -1579,14 +1579,14 @@ static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh,if (err)return err; + ctx =NULL ;if (rt) {struct xfrm_user_sec_ctx *uctx =nla_data (rt); err =security_xfrm_policy_alloc (&ctx, uctx);if (err)return err; - }else - ctx =NULL ; + } xp =xfrm_policy_bysel_ctx (type, p->dir, &p->sel, ctx,0 , &err);security_xfrm_policy_free (ctx); }
Signature · 1 line
1.5.3.rc5
Quoted 26 lines · Denis V. Lunev
When
CONFIG_SECURITY_NETWORK_XFRMis 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 functionnet/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_allocis noop for the case).It seems that they are result of the commit
03e1ad7b5d871d4189b1da3125c2f12d1b5f7d0bSigned-off-by Denis V. Lunev <[email protected]>--- net/xfrm/xfrm_user.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)net/xfrm/xfrm_user.c +1
-0@@ -1343,14 +1343,14 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh, if (err) return err; + ctx =NULL ;if (rt) {struct xfrm_user_sec_ctx *uctx =nla_data (rt);
net/xfrm/xfrm_user.c static int xfrm_get_policy(struct sk_buff · line 1356
Quoted 10 lines
net/xfrm/xfrm_user.c +1
-2err =security_xfrm_policy_alloc (&ctx, uctx);if (err)return err; - }else - ctx =NULL ; + } xp =xfrm_policy_bysel_ctx (type, p->dir, &p->sel, ctx, delete, &err);security_xfrm_policy_free (ctx);
Thanks for catching this, I was focusing more on the runtime issues with the else statement and forgot about compile time issues. I wonder if it would be better to fix this in the dummy function for security_xfrm_policy_alloc()? It seems cleaner to me.
Signature · 2 lines
paul moore linux @ hp
From: "Denis V. Lunev" <[email protected]>
Date: Mon, 14 Apr 2008 17:03:39 +0400
Quoted 9 lines
When
CONFIG_SECURITY_NETWORK_XFRMis 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 functionnet/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_allocis noop for the case).It seems that they are result of the commit
03e1ad7b5d871d4189b1da3125c2f12d1b5f7d0b
Needs commit header-line text reference after commit ID, which I've added. I think I've mentioned this issue to you on several occaisions already :-/
Quoted 1 line
Signed-off-by Denis V. Lunev <[email protected]>
Applied, thanks.
David Miller
maintainerFrom: Paul Moore <[email protected]>
Date: Mon, 14 Apr 2008 10:35:46 -0400
Quoted 4 lines
Thanks for catching this, I was focusing more on the runtime issues with the else statement and forgot about compile time issues. I wonder if it would be better to fix this in the dummy function for
security_xfrm_policy_alloc()? It seems cleaner to me.
I think in this specific case the choice is arbitrary, which is why I applied his patch.
Quoted 10 lines · David Miller
From: "Denis V. Lunev" <[email protected]>
Date: Mon, 14 Apr 2008 17:03:39 +0400Quoted 7 lines
When
CONFIG_SECURITY_NETWORK_XFRMis 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 functionnet/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_allocis noop for the case).
Quoted 6 lines
Quoted 2 lines
It seems that they are result of the commit
03e1ad7b5d871d4189b1da3125c2f12d1b5f7d0bNeeds commit header-line text reference after commit ID, which I've added. I think I've mentioned this issue to you on several occaisions already :-/
got it again. Thank you.