Commit ffff7ee8 authored by Simon Horman's avatar Simon Horman Committed by Jakub Kicinski

bnxt_en: Extend maximum length of version string by 1 byte

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: default avatarSimon Horman <horms@kernel.org>
Reviewed-by: default avatarMichael Chan <michael.chan@broadcom.com>
Link: https://patch.msgid.link/20240813-bnxt-str-v2-1-872050a157e7@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 2984e69a
...@@ -4161,7 +4161,7 @@ static void bnxt_get_pkgver(struct net_device *dev) ...@@ -4161,7 +4161,7 @@ static void bnxt_get_pkgver(struct net_device *dev)
if (!bnxt_get_pkginfo(dev, buf, sizeof(buf))) { if (!bnxt_get_pkginfo(dev, buf, sizeof(buf))) {
len = strlen(bp->fw_ver_str); 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); "/pkg %s", buf);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment