# Re: \[PATCH net\] ethtool: strset: Fix reply\_size value

- From: Michal Kubecek \<hidden\>
- Date: 2021-06-17 16:29:31 
- List: netdev
- Page: https://ratatoskr.run/netdev/2021/06/11205693
- Thread: https://ratatoskr.run/netdev/2021/06/11205688/t.md

```text
On Thu, Jun 17, 2021 at 06:42:52PM +0300, Amit Cohen wrote:
> strset_reply_size() does not take into account the size required for the
> 'ETHTOOL_A_STRSET_STRINGSETS' nested attribute.
> Since commit 4d1fb7cde0cc ("ethtool: add a stricter length check") this
> results in the following warning in the kernel log:
> 
> ethnl cmd 1: calculated reply length 2236, but consumed 2240
> WARNING: CPU: 2 PID: 30549 at net/ethtool/netlink.c:360 ethnl_default_doit+0x29f/0x310
> 
> Add the appropriate size to the calculation.
> 
> Fixes: 71921690f974 ("ethtool: provide string sets with STRSET_GET request")
> Signed-off-by: Amit Cohen <redacted>
> Reviewed-by: Jiri Pirko <redacted>
> Reviewed-by: Ido Schimmel <idosch@nvidia.com>
> Tested-by: Ido Schimmel <idosch@nvidia.com>
> ---
>  net/ethtool/strset.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ethtool/strset.c b/net/ethtool/strset.c
> index b3029fff715d..86dcb6b099b3 100644
> --- a/net/ethtool/strset.c
> +++ b/net/ethtool/strset.c
> @@ -365,7 +365,7 @@ static int strset_reply_size(const struct ethnl_req_info *req_base,
>  		len += ret;
>  	}
>  
> -	return len;
> +	return nla_total_size(len);
>  }
>  
>  /* fill one string into reply */

I believe this issue has been already fixed in net tree by commit
e175aef90269 ("ethtool: strset: fix message length calculation") but as
this commit has not been merged into net-next yet, you could hit it with
the stricter check.

Michal
```
