]> Git Repo - linux.git/commitdiff
nexthop: fix uninitialized variable in nla_put_nh_group_stats()
authorDan Carpenter <[email protected]>
Thu, 21 Mar 2024 14:42:18 +0000 (17:42 +0300)
committerJakub Kicinski <[email protected]>
Sat, 23 Mar 2024 01:03:29 +0000 (18:03 -0700)
The "*hw_stats_used" value needs to be set on the success paths to prevent
an uninitialized variable bug in the caller, nla_put_nh_group_stats().

Fixes: 5072ae00aea4 ("net: nexthop: Expose nexthop group HW stats to user space")
Signed-off-by: Dan Carpenter <[email protected]>
Reviewed-by: Jiri Pirko <[email protected]>
Reviewed-by: Ido Schimmel <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
net/ipv4/nexthop.c

index 74928a9d1aa48bae5fe4f56ac05d2a32cd8d6a7e..535856b0f0edce6d8dae47126b42125c178df889 100644 (file)
@@ -768,8 +768,10 @@ static int nh_grp_hw_stats_update(struct nexthop *nh, bool *hw_stats_used)
        struct net *net = nh->net;
        int err;
 
-       if (nexthop_notifiers_is_empty(net))
+       if (nexthop_notifiers_is_empty(net)) {
+               *hw_stats_used = false;
                return 0;
+       }
 
        err = nh_notifier_grp_hw_stats_init(&info, nh);
        if (err)
This page took 0.063364 seconds and 4 git commands to generate.