* [PATCH] Fix af_key.c compiler warning
@ 2008-04-25 2:53 Brian Haley
2008-04-25 3:39 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Brian Haley @ 2008-04-25 2:53 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: Type: text/plain, Size: 393 bytes --]
net/key/af_key.c: In function ‘pfkey_spddelete’:
net/key/af_key.c:2359: warning: ‘pol_ctx’ may be used uninitialized in
this function
When CONFIG_SECURITY_NETWORK_XFRM isn't set,
security_xfrm_policy_alloc() is an inline that doesn't set pol_ctx, so
this seemed like the easiest fix short of using *uninitialized_var(pol_ctx).
-Brian
Signed-off-by: Brian Haley <brian.haley@hp.com>
---
[-- Attachment #2: pol_ctx.patch --]
[-- Type: text/x-patch, Size: 780 bytes --]
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 81a8e52..2403a31 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -2356,7 +2356,7 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, struct sadb_msg
struct xfrm_selector sel;
struct km_event c;
struct sadb_x_sec_ctx *sec_ctx;
- struct xfrm_sec_ctx *pol_ctx;
+ struct xfrm_sec_ctx *pol_ctx = NULL;
if (!present_and_same_family(ext_hdrs[SADB_EXT_ADDRESS_SRC-1],
ext_hdrs[SADB_EXT_ADDRESS_DST-1]) ||
@@ -2396,8 +2396,7 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, struct sadb_msg
kfree(uctx);
if (err)
return err;
- } else
- pol_ctx = NULL;
+ }
xp = xfrm_policy_bysel_ctx(XFRM_POLICY_TYPE_MAIN,
pol->sadb_x_policy_dir - 1, &sel, pol_ctx,
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix af_key.c compiler warning
2008-04-25 2:53 [PATCH] Fix af_key.c compiler warning Brian Haley
@ 2008-04-25 3:39 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-04-25 3:39 UTC (permalink / raw)
To: brian.haley; +Cc: netdev
From: Brian Haley <brian.haley@hp.com>
Date: Thu, 24 Apr 2008 22:53:38 -0400
> net/key/af_key.c: In function ‘pfkey_spddelete’:
> net/key/af_key.c:2359: warning: ‘pol_ctx’ may be used uninitialized in
> this function
>
> When CONFIG_SECURITY_NETWORK_XFRM isn't set,
> security_xfrm_policy_alloc() is an inline that doesn't set pol_ctx, so
> this seemed like the easiest fix short of using *uninitialized_var(pol_ctx).
>
> Signed-off-by: Brian Haley <brian.haley@hp.com>
I had been meaning to kill this one off myself, thanks for
taking care of this Brian.
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-04-25 3:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-25 2:53 [PATCH] Fix af_key.c compiler warning Brian Haley
2008-04-25 3:39 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).