Re: [External] : Re: [PATCH net] net: thunderx: Fix format-truncation warning in bgx_acpi_match_id()

From: ALOK TIWARI
Date: Mon Jul 07 2025 - 23:05:22 EST




On 7/8/2025 12:46 AM, Simon Horman wrote:
drivers/net/ethernet/cavium/thunder/thunder_bgx.c:1434:23: note:
directive argument in the range [0, 255]
snprintf(bgx_sel, 5, "BGX%d", bgx->bgx_id);
^~~~~~~
drivers/net/ethernet/cavium/thunder/thunder_bgx.c:1434:2: note:
‘snprintf’ output between 5 and 7 bytes into a destination of size 5
snprintf(bgx_sel, 5, "BGX%d", bgx->bgx_id);

compiler warning due to insufficient snprintf buffer size.

Signed-off-by: Alok Tiwari<alok.a.tiwari@xxxxxxxxxx>
Thanks Alok,

I agree this is a good change.

However, by my reading the range of values of bgx->bgx_id is 0 - 8
because of the application of BGX_ID_MASK which restricts the
value to 3 bits.

If so, I don't think this is a bug and it should be targeted at net-next.
With a description of why it is not a bug.

Conversely, you think it is a bug, then I think an explanation as to why
would be nice to add to the commit description. And A fixes tag is needed.

Thanks Simon,
It is compile warning, We can target it for net-next.

I will resend it with [PATCH net-next]

Thanks,
Alok