* [PATCH net-next] eth: bnxt: fix string truncation warning in FW version
@ 2025-01-17 18:37 Jakub Kicinski
2025-01-17 19:48 ` Michael Chan
2025-01-19 1:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2025-01-17 18:37 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, Jakub Kicinski,
michael.chan, pavan.chebbi
W=1 builds with gcc 14.2.1 report:
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:4193:32: error: ‘%s’ directive output may be truncated writing up to 31 bytes into a region of size 27 [-Werror=format-truncation=]
4193 | "/pkg %s", buf);
It's upset that we let buf be full length but then we use 5
characters for "/pkg ".
The builds is also clear with clang version 19.1.5 now.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: michael.chan@broadcom.com
CC: pavan.chebbi@broadcom.com
---
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
index 540c140d52dc..65a20931c579 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
@@ -4184,7 +4184,7 @@ int bnxt_get_pkginfo(struct net_device *dev, char *ver, int size)
static void bnxt_get_pkgver(struct net_device *dev)
{
struct bnxt *bp = netdev_priv(dev);
- char buf[FW_VER_STR_LEN];
+ char buf[FW_VER_STR_LEN - 5];
int len;
if (!bnxt_get_pkginfo(dev, buf, sizeof(buf))) {
--
2.48.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net-next] eth: bnxt: fix string truncation warning in FW version
2025-01-17 18:37 [PATCH net-next] eth: bnxt: fix string truncation warning in FW version Jakub Kicinski
@ 2025-01-17 19:48 ` Michael Chan
2025-01-19 1:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Michael Chan @ 2025-01-17 19:48 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
pavan.chebbi
[-- Attachment #1: Type: text/plain, Size: 720 bytes --]
On Fri, Jan 17, 2025 at 10:37 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> W=1 builds with gcc 14.2.1 report:
>
> drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:4193:32: error: ‘%s’ directive output may be truncated writing up to 31 bytes into a region of size 27 [-Werror=format-truncation=]
> 4193 | "/pkg %s", buf);
>
> It's upset that we let buf be full length but then we use 5
> characters for "/pkg ".
>
> The builds is also clear with clang version 19.1.5 now.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
There is actually more truncation because of the string before "/pkg ".
Since this works,
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] eth: bnxt: fix string truncation warning in FW version
2025-01-17 18:37 [PATCH net-next] eth: bnxt: fix string truncation warning in FW version Jakub Kicinski
2025-01-17 19:48 ` Michael Chan
@ 2025-01-19 1:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-01-19 1:50 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
michael.chan, pavan.chebbi
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 17 Jan 2025 10:37:26 -0800 you wrote:
> W=1 builds with gcc 14.2.1 report:
>
> drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:4193:32: error: ‘%s’ directive output may be truncated writing up to 31 bytes into a region of size 27 [-Werror=format-truncation=]
> 4193 | "/pkg %s", buf);
>
> It's upset that we let buf be full length but then we use 5
> characters for "/pkg ".
>
> [...]
Here is the summary with links:
- [net-next] eth: bnxt: fix string truncation warning in FW version
https://git.kernel.org/netdev/net-next/c/17656eb5cfe5
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-01-19 1:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-17 18:37 [PATCH net-next] eth: bnxt: fix string truncation warning in FW version Jakub Kicinski
2025-01-17 19:48 ` Michael Chan
2025-01-19 1:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).