Re: [PATCH net v2] eth: fbnic: Avoid rounding zero ring sizes

From: Joe Damato

Date: Fri Sep 18 2026 - 19:03:45 EST


On Fri, Sep 18, 2026 at 01:46:40PM +0200, Björn Töpel wrote:
> roundup_pow_of_two() is undefined for zero. ethtool permits a zero ring
> size to reach the driver, where the minimum-size check should reject it.
>
> Leave zero unchanged while rounding nonzero ring sizes. The minimum-size
> check then rejects zero deterministically without changing the established
> behavior for other values.
>
> Fixes: 6cbf18a05c06 ("eth: fbnic: support ring size configuration")
> Reported-by: Sashiko <netdev-bot+sashiko@xxxxxxxxxx>
> Link: https://lore.kernel.org/netdev/178971206933.22033.236948278674126701@xxxxxxxxxx/
> Suggested-by: Alexander Duyck <alexanderduyck@xxxxxx>
> Signed-off-by: Björn Töpel <bjorn@xxxxxxxxxx>
>
> ---
> v2:
> - Preserve rounding before minimum-size validation for nonzero values;
> Sashiko found that v1 rejected values which previously rounded up to a
> valid size.
> ---
> drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)

Reviewed-by: Joe Damato <joe@xxxxxxx>