xdp: fix uninitialized 'err' variable
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 xdp: fix uninitialized 'err' variable
Smatch caught an uninitialized variable error which GCC seems to miss.
Fixes a25717d2b604 ("xdp: support simultaneous driver and hw XDP attachment")
Signed-off-by Jakub Kicinski <[email protected]>
--- net/core/rtnetlink.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
net/core/rtnetlink.c +9 -6
@@ -1414,14 +1414,17 @@ static int rtnl_xdp_fill(struct sk_buff *skb, struct net_device *dev) prog_id =0 ; mode =XDP_ATTACHED_NONE ; -if (rtnl_xdp_report_one (skb, dev, &prog_id, &mode,XDP_ATTACHED_SKB , -IFLA_XDP_SKB_PROG_ID , rtnl_xdp_prog_skb)) + err =rtnl_xdp_report_one (skb, dev, &prog_id, &mode,XDP_ATTACHED_SKB , +IFLA_XDP_SKB_PROG_ID , rtnl_xdp_prog_skb); +if (err) goto err_cancel; -if (rtnl_xdp_report_one (skb, dev, &prog_id, &mode,XDP_ATTACHED_DRV , -IFLA_XDP_DRV_PROG_ID , rtnl_xdp_prog_drv)) + err =rtnl_xdp_report_one (skb, dev, &prog_id, &mode,XDP_ATTACHED_DRV , +IFLA_XDP_DRV_PROG_ID , rtnl_xdp_prog_drv); +if (err) goto err_cancel; -if (rtnl_xdp_report_one (skb, dev, &prog_id, &mode,XDP_ATTACHED_HW , -IFLA_XDP_HW_PROG_ID , rtnl_xdp_prog_hw)) + err =rtnl_xdp_report_one (skb, dev, &prog_id, &mode,XDP_ATTACHED_HW , +IFLA_XDP_HW_PROG_ID , rtnl_xdp_prog_hw); +if (err) goto err_cancel; err =nla_put_u8 (skb,IFLA_XDP_ATTACHED , mode);
Signature · 1 line
2.17.1
Quoted 5 lines · Jakub Kicinski
Smatch caught an uninitialized variable error which GCC seems to miss.
Fixes a25717d2b604 ("xdp: support simultaneous driver and hw XDP attachment")Signed-off-by Jakub Kicinski <[email protected]>
Acked-by Daniel Borkmann <[email protected]>
David, feel free to take this directly into net-next, thanks!
From: Jakub Kicinski <[email protected]>
Date: Mon, 16 Jul 2018 19:08:50 -0700
Quoted 5 lines
Smatch caught an uninitialized variable error which GCC seems to miss.
Fixes a25717d2b604 ("xdp: support simultaneous driver and hw XDP attachment")Signed-off-by Jakub Kicinski <[email protected]>
Applied.