Skip to content

Commit

Permalink
af_key: Fix af_key.c compiler warning
Browse files Browse the repository at this point in the history
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

When CONFIG_SECURITY_NETWORK_XFRM isn't set, 
security_xfrm_policy_alloc() is an inline that doesn't set pol_ctx, so 
this seemed like the easiest fix short of using *uninitialized_var(pol_ctx).

Signed-off-by: Brian Haley <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Brian Haley authored and davem330 committed Apr 25, 2008
1 parent 9edb74c commit 2db3e47
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions net/key/af_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -2356,7 +2356,7 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, struct sadb_msg
struct xfrm_selector sel;
struct km_event c;
struct sadb_x_sec_ctx *sec_ctx;
struct xfrm_sec_ctx *pol_ctx;
struct xfrm_sec_ctx *pol_ctx = NULL;

if (!present_and_same_family(ext_hdrs[SADB_EXT_ADDRESS_SRC-1],
ext_hdrs[SADB_EXT_ADDRESS_DST-1]) ||
Expand Down Expand Up @@ -2396,8 +2396,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,
Expand Down

0 comments on commit 2db3e47

Please sign in to comment.