Subject: Re: [PATCH net-next 3/7] net: nexthop: Add nexthop group entry stats

From: Simon Horman <[email-masked]>
Date: Wed, 28 Feb 2024 14:30:04 +0000

On Tue, Feb 27, 2024 at 07:17:28PM +0100, Petr Machata wrote:

...

> @@ -2483,6 +2492,12 @@ static struct nexthop *nexthop_create_group(struct net *net,
>  		if (nhi->family == AF_INET)
>  			nhg->has_v4 = true;
>  
> +		nhg->nh_entries[i].stats =
> +			netdev_alloc_pcpu_stats(struct nh_grp_entry_stats);
> +		if (!nhg->nh_entries[i].stats) {
> +			nexthop_put(nhe);
> +			goto out_no_nh;

Hi Petr and Ido,

Jumping to the out_no_nh label will result in err being returned,
however it appears that err is uninitialised here. Perhaps
it should be set to a negative error value?

Flagged by Smatch.

> +		}
>  		nhg->nh_entries[i].nh = nhe;
>  		nhg->nh_entries[i].weight = entry[i].weight + 1;
>  		list_add(&nhg->nh_entries[i].nh_list, &nhe->grp_list);

...