Re: [PATCH net v3 1/1] ethtool: Fix mod state of verbose no_mask bitset

From: Simon Horman
Date: Tue Oct 10 2023 - 11:19:17 EST


On Mon, Oct 09, 2023 at 03:36:45PM +0200, Köry Maincent wrote:
> From: Kory Maincent <kory.maincent@xxxxxxxxxxx>
>
> A bitset without mask in a _SET request means we want exactly the bits in
> the bitset to be set. This works correctly for compact format but when
> verbose format is parsed, ethnl_update_bitset32_verbose() only sets the
> bits present in the request bitset but does not clear the rest. The commit
> 6699170376ab fixes this issue by clearing the whole target bitmap before we
> start iterating. The solution proposed brought an issue with the behavior
> of the mod variable. As the bitset is always cleared the old val will
> always differ to the new val.
>
> Fix it by adding a new temporary variable which save the state of the old
> bitmap.
>
> Fixes: 6699170376ab ("ethtool: fix application of verbose no_mask bitset")
> Signed-off-by: Kory Maincent <kory.maincent@xxxxxxxxxxx>
> ---
>
> Changes in v2:
> - Fix the allocated size.
>
> Changes in v3:
> - Add comment.
> - Updated variable naming.
> - Add orig_bitmap variable to avoid n_mask condition in the
> nla_for_each_nested() loop.

Hi Köry,

thanks for the updates. This one looks good to me.

Reviewed-by: Simon Horman <horms@xxxxxxxxxx>