xfrm: potential uninitialized variable num_xfrms
Subsystems (3)
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
@@ -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 ;
David Miller
maintainerFrom: Changli Gao <[email protected]>
Date: Wed, 28 Apr 2010 15:20:22 +0800
Quoted 5 lines
potential uninitialized variable
num_xfrmsfix compiler warning: '
num_xfrms' may be used uninitialized in this function.Signed-off-by Changli Gao <[email protected]>
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.
David Miller
maintainerFrom: Changli Gao <[email protected]>
Date: Wed, 28 Apr 2010 15:20:22 +0800
Quoted 5 lines
potential uninitialized variable
num_xfrmsfix compiler warning: '
num_xfrms' may be used uninitialized in this function.Signed-off-by Changli Gao <[email protected]>
I decided to apply this after all, thanks!