Skip to content

Commit 7c3ae3e

Browse files
committed
nexthop: fix uninitialized variable in nla_put_nh_group_stats()
JIRA: https://issues.redhat.com/browse/RHEL-59118 commit 9145e22 Author: Dan Carpenter <dan.carpenter@linaro.org> Date: Thu Mar 21 17:42:18 2024 +0300 nexthop: fix uninitialized variable in nla_put_nh_group_stats() 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: 5072ae0 ("net: nexthop: Expose nexthop group HW stats to user space") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Link: https://lore.kernel.org/r/f08ac289-d57f-4a1a-830f-cf9a0563cb9c@moroto.mountain Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Ivan Vecera <ivecera@redhat.com>
1 parent 11bdc36 commit 7c3ae3e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/ipv4/nexthop.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,8 +768,10 @@ static int nh_grp_hw_stats_update(struct nexthop *nh, bool *hw_stats_used)
768768
struct net *net = nh->net;
769769
int err;
770770

771-
if (nexthop_notifiers_is_empty(net))
771+
if (nexthop_notifiers_is_empty(net)) {
772+
*hw_stats_used = false;
772773
return 0;
774+
}
773775

774776
err = nh_notifier_grp_hw_stats_init(&info, nh);
775777
if (err)

0 commit comments

Comments
 (0)