Skip to contentSkip to conversation

Silence 'may be used uninitialized' warning in net/key/af_key.c

PATCH New Tony Breeds 1 participant 1 message Apr 24, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Silence 'may be used uninitialized' warning in net/key/af_key.c

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.

---
 net/key/af_key.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
net/key/af_key.c +2 -2
index 81a8e52..48923e0 100644
@@ -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,
Signature · 7 lines
1.5.5.1


Yours Tony

  linux.conf.au    http://www.marchsouth.org/
  Jan 19 - 24 2009 The Australian Linux Technical Conference!