Commit 9145e224 authored by Dan Carpenter's avatar Dan Carpenter Committed by Jakub Kicinski

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: 5072ae00 ("net: nexthop: Expose nexthop group HW stats to user space")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
Link: https://lore.kernel.org/r/f08ac289-d57f-4a1a-830f-cf9a0563cb9c@moroto.mountainSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent f6c8f5e8
...@@ -768,8 +768,10 @@ static int nh_grp_hw_stats_update(struct nexthop *nh, bool *hw_stats_used) ...@@ -768,8 +768,10 @@ static int nh_grp_hw_stats_update(struct nexthop *nh, bool *hw_stats_used)
struct net *net = nh->net; struct net *net = nh->net;
int err; int err;
if (nexthop_notifiers_is_empty(net)) if (nexthop_notifiers_is_empty(net)) {
*hw_stats_used = false;
return 0; return 0;
}
err = nh_notifier_grp_hw_stats_init(&info, nh); err = nh_notifier_grp_hw_stats_init(&info, nh);
if (err) if (err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment