Re: [PATCH] ethtool: Fix and optimize ethtool_convert_link_mode_to_legacy_u32()

From: Jakub Kicinski
Date: Tue May 24 2022 - 19:21:57 EST


On Wed, 25 May 2022 00:38:19 +0200 Marco Bonelli wrote:
> Fix the implementation of ethtool_convert_link_mode_to_legacy_u32(), which
> is supposed to return false if src has bits higher than 31 set. The current
> implementation uses the complement of bitmap_fill(ext, 32) to test high
> bits of src, which is wrong as bitmap_fill() fills _with long granularity_,
> and sizeof(long) can be > 4. No users of this function currently check the
> return value, so the bug was dormant.
>
> Also remove the check for __ETHTOOL_LINK_MODE_MASK_NBITS > 32, as the enum
> ethtool_link_mode_bit_indices contains far beyond 32 values. Using
> find_next_bit() to test the src bitmask works regardless of this anyway.
>
> Signed-off-by: Marco Bonelli <marco@xxxxxxxxxx>

# Form letter - net-next is closed

We have already sent the networking pull request for 5.19
and therefore net-next is closed for new drivers, features,
code refactoring and optimizations. We are currently accepting
bug fixes only.

Please repost when net-next reopens after 5.19-rc1 is cut.

RFC patches sent for review only are obviously welcome at any time.