lkml.org 
[lkml]   [2008]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH] Silence 'may be used uninitialized' warning in net/key/af_key.c
From
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!



\
 
 \ /
  Last update: 2008-04-24 06:35    [W:0.428 / U:0.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site