Skip to content

Commit 732bc2f

Browse files
Tom Rixpcmoore
authored andcommitted
selinux: initialize proto variable in selinux_ip_postroute_compat()
Clang static analysis reports this warning hooks.c:5765:6: warning: 4th function call argument is an uninitialized value if (selinux_xfrm_postroute_last(sksec->sid, skb, &ad, proto)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ selinux_parse_skb() can return ok without setting proto. The later call to selinux_xfrm_postroute_last() does an early check of proto and can return ok if the garbage proto value matches. So initialize proto. Cc: [email protected] Fixes: eef9b41 ("selinux: cleanup selinux_xfrm_sock_rcv_skb() and selinux_xfrm_postroute_last()") Signed-off-by: Tom Rix <[email protected]> [PM: typo/spelling and checkpatch.pl description fixes] Signed-off-by: Paul Moore <[email protected]>
1 parent cc274ae commit 732bc2f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

security/selinux/hooks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5785,7 +5785,7 @@ static unsigned int selinux_ip_postroute_compat(struct sk_buff *skb,
57855785
struct sk_security_struct *sksec;
57865786
struct common_audit_data ad;
57875787
struct lsm_network_audit net = {0,};
5788-
u8 proto;
5788+
u8 proto = 0;
57895789

57905790
sk = skb_to_full_sk(skb);
57915791
if (sk == NULL)

0 commit comments

Comments
 (0)