* [PATCH 1/1 net-2.6.26] [XFRM]: Compilation warnings in xfrm_user.c.
@ 2008-04-14 13:03 Denis V. Lunev
2008-04-14 14:35 ` Paul Moore
2008-04-14 21:48 ` David Miller
0 siblings, 2 replies; 5+ messages in thread
From: Denis V. Lunev @ 2008-04-14 13:03 UTC (permalink / raw
To: davem; +Cc: herbert, paul.moore, netdev, Denis V. Lunev
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
03e1ad7b5d871d4189b1da3125c2f12d1b5f7d0b
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
net/xfrm/xfrm_user.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index b822b56..1810f56 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -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);
}
--
1.5.3.rc5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1 net-2.6.26] [XFRM]: Compilation warnings in xfrm_user.c.
2008-04-14 13:03 [PATCH 1/1 net-2.6.26] [XFRM]: Compilation warnings in xfrm_user.c Denis V. Lunev
@ 2008-04-14 14:35 ` Paul Moore
2008-04-14 21:52 ` David Miller
2008-04-14 21:48 ` David Miller
1 sibling, 1 reply; 5+ messages in thread
From: Paul Moore @ 2008-04-14 14:35 UTC (permalink / raw
To: Denis V. Lunev; +Cc: davem, herbert, netdev
On Monday 14 April 2008 9:03:39 am Denis V. Lunev wrote:
> 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
> 03e1ad7b5d871d4189b1da3125c2f12d1b5f7d0b
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> ---
> net/xfrm/xfrm_user.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
> index b822b56..1810f56 100644
> --- a/net/xfrm/xfrm_user.c
> +++ b/net/xfrm/xfrm_user.c
> @@ -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);
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.
--
paul moore
linux @ hp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1 net-2.6.26] [XFRM]: Compilation warnings in xfrm_user.c.
2008-04-14 13:03 [PATCH 1/1 net-2.6.26] [XFRM]: Compilation warnings in xfrm_user.c Denis V. Lunev
2008-04-14 14:35 ` Paul Moore
@ 2008-04-14 21:48 ` David Miller
2008-04-15 5:48 ` Denis V. Lunev
1 sibling, 1 reply; 5+ messages in thread
From: David Miller @ 2008-04-14 21:48 UTC (permalink / raw
To: den; +Cc: herbert, paul.moore, netdev
From: "Denis V. Lunev" <den@openvz.org>
Date: Mon, 14 Apr 2008 17:03:39 +0400
> 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
> 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 :-/
> Signed-off-by: Denis V. Lunev <den@openvz.org>
Applied, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1 net-2.6.26] [XFRM]: Compilation warnings in xfrm_user.c.
2008-04-14 14:35 ` Paul Moore
@ 2008-04-14 21:52 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2008-04-14 21:52 UTC (permalink / raw
To: paul.moore; +Cc: den, herbert, netdev
From: Paul Moore <paul.moore@hp.com>
Date: Mon, 14 Apr 2008 10:35:46 -0400
> 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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1 net-2.6.26] [XFRM]: Compilation warnings in xfrm_user.c.
2008-04-14 21:48 ` David Miller
@ 2008-04-15 5:48 ` Denis V. Lunev
0 siblings, 0 replies; 5+ messages in thread
From: Denis V. Lunev @ 2008-04-15 5:48 UTC (permalink / raw
To: David Miller; +Cc: herbert, paul.moore, netdev
On Mon, 2008-04-14 at 14:48 -0700, David Miller wrote:
> From: "Denis V. Lunev" <den@openvz.org>
> Date: Mon, 14 Apr 2008 17:03:39 +0400
>
> > 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
> > 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 :-/
got it again. Thank you.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-04-15 5:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-14 13:03 [PATCH 1/1 net-2.6.26] [XFRM]: Compilation warnings in xfrm_user.c Denis V. Lunev
2008-04-14 14:35 ` Paul Moore
2008-04-14 21:52 ` David Miller
2008-04-14 21:48 ` David Miller
2008-04-15 5:48 ` Denis V. Lunev
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.