Re: [PATCH] net: rtnetlink: fix error handling in rtnl_fill_statsinfo()

From: Ido Schimmel
Date: Mon Mar 07 2022 - 02:16:19 EST


On Sat, Mar 05, 2022 at 10:13:46AM -0800, trix@xxxxxxxxxx wrote:
> From: Tom Rix <trix@xxxxxxxxxx>
>
> The clang static analyzer reports this issue
> rtnetlink.c:5481:2: warning: Undefined or garbage
> value returned to caller
> return err;
> ^~~~~~~~~~
>
> There is a function level err variable, in the
> list_for_each_entry_rcu block there is a shadow
> err. Remove the shadow.
>
> In the same block, the call to nla_nest_start_noflag()
> can fail without setting an err. Set the err
> to -EMSGSIZE.
>
> Fixes: 216e690631f5 ("net: rtnetlink: rtnl_fill_statsinfo(): Permit non-EMSGSIZE error returns")
> Signed-off-by: Tom Rix <trix@xxxxxxxxxx>

For net-next:

Reviewed-by: Ido Schimmel <idosch@xxxxxxxxxx>

Thanks