Skip to content

Commit 6700abc

Browse files
committed
eth: bnxt: fix string truncation warning in FW version
JIRA: https://issues.redhat.com/browse/RHEL-106550 commit 17656eb Author: Jakub Kicinski <kuba@kernel.org> Date: Fri Jan 17 10:37:26 2025 -0800 eth: bnxt: fix string truncation warning in FW version 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. Reviewed-by: Michael Chan <michael.chan@broadcom.com> Link: https://patch.msgid.link/20250117183726.1481524-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
1 parent 6e1782c commit 6700abc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4212,7 +4212,7 @@ int bnxt_get_pkginfo(struct net_device *dev, char *ver, int size)
42124212
static void bnxt_get_pkgver(struct net_device *dev)
42134213
{
42144214
struct bnxt *bp = netdev_priv(dev);
4215-
char buf[FW_VER_STR_LEN];
4215+
char buf[FW_VER_STR_LEN - 5];
42164216
int len;
42174217

42184218
if (!bnxt_get_pkginfo(dev, buf, sizeof(buf))) {

0 commit comments

Comments
 (0)