Skip to contentSkip to conversation

xfrm: potential uninitialized variable num_xfrms

PATCH In review Changli Gao 2 participants 3 messages Apr 28, 2010 – Apr 30, 2010

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

PATCH 1/1 xfrm: potential uninitialized variable num_xfrms

potential uninitialized variable num_xfrms

fix compiler warning: 'num_xfrms' may be used uninitialized in this function.

----

 net/xfrm/xfrm_policy.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/xfrm/xfrm_policy.c +1 -1
index 7430ac2..31f4ba4 100644
@@ -1732,7 +1732,7 @@ int __xfrm_lookup(struct net *net, struct dst_entry **dst_p, struct flowi *fl,
 	struct dst_entry *dst, *dst_orig = *dst_p, *route;
 	u16 family = dst_orig->ops->family;
 	u8 dir = policy_to_flow_dir(XFRM_POLICY_OUT);
-	int i, err, num_pols, num_xfrms, drop_pols = 0;
+	int i, err, num_pols, num_xfrms = 0, drop_pols = 0;
 
 restart:
 	dst = NULL;
maintainer
#1 lore raw

From: Changli Gao <[email protected]>
Date: Wed, 28 Apr 2010 15:20:22 +0800

Quoted 5 lines

potential uninitialized variable num_xfrms

fix compiler warning: 'num_xfrms' may be used uninitialized in this function.

We've all been seeing it for weeks too, but I honestly have reservations about trying to simply pacify the compiler here.

The num_xfrms variable is only used in code paths that actually initialize it's value. The compiler just can't see this in the control flow.

Check it if you don't believe me.