]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bnxt_en: Extend maximum length of version string by 1 byte
authorSimon Horman <horms@kernel.org>
Tue, 13 Aug 2024 14:32:55 +0000 (15:32 +0100)
committerJakub Kicinski <kuba@kernel.org>
Thu, 15 Aug 2024 03:36:16 +0000 (20:36 -0700)
This corrects an out-by-one error in the maximum length of the package
version string. The size argument of snprintf includes space for the
trailing '\0' byte, so there is no need to allow extra space for it by
reducing the value of the size argument by 1.

Found by inspection.
Compile tested only.

Signed-off-by: Simon Horman <horms@kernel.org>
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Link: https://patch.msgid.link/20240813-bnxt-str-v2-1-872050a157e7@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

index 61d6afc3cacb738938855365474e82c2646d19a2..39eed5831e3ab96fcd57aeb145058d4843c3c7ff 100644 (file)
@@ -4161,7 +4161,7 @@ static void bnxt_get_pkgver(struct net_device *dev)
 
        if (!bnxt_get_pkginfo(dev, buf, sizeof(buf))) {
                len = strlen(bp->fw_ver_str);
-               snprintf(bp->fw_ver_str + len, FW_VER_STR_LEN - len - 1,
+               snprintf(bp->fw_ver_str + len, FW_VER_STR_LEN - len,
                         "/pkg %s", buf);
        }
 }