* [PATCH] Silence 'may be used uninitialized' warning in net/key/af_key.c
@ 2008-04-24 4:33 Tony Breeds
0 siblings, 0 replies; only message in thread
From: Tony Breeds @ 2008-04-24 4:33 UTC (permalink / raw)
To: David Miller, linux-net; +Cc: Linux Kernel ML, Andrew Morton
Currently the kernel warns about:
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
Certainly in the case that CONFIG_SECURITY_NETWORK_XFRM is not set a bogus
value for pol_ctx will be passed arround. Unconditonnaly initialise to NULL,
to avoid this problem.
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
---
net/key/af_key.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 81a8e52..48923e0 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -2385,6 +2385,7 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, struct sadb_msg
if (sel.dport)
sel.dport_mask = htons(0xffff);
+ pol_ctx = NULL;
sec_ctx = (struct sadb_x_sec_ctx *) ext_hdrs[SADB_X_EXT_SEC_CTX-1];
if (sec_ctx != NULL) {
struct xfrm_user_sec_ctx *uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx);
@@ -2396,8 +2397,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,
--
1.5.5.1
Yours Tony
linux.conf.au http://www.marchsouth.org/
Jan 19 - 24 2009 The Australian Linux Technical Conference!
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-04-24 4:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-24 4:33 [PATCH] Silence 'may be used uninitialized' warning in net/key/af_key.c Tony Breeds
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®