aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/ibm
diff options
context:
space:
mode:
authorLijun Pan <lijunp213@gmail.com>2021-06-11 13:33:53 -0500
committerDavid S. Miller <davem@davemloft.net>2021-06-11 13:56:23 -0700
commit0b217d3d746233ace52b5dcb26974e929abf62c5 (patch)
tree558bc5a65de1f838517c7b20bb6cfe2e1a9f910c /drivers/net/ethernet/ibm
parentMerge branch 'sja1105-xpcs' (diff)
downloadlinux-dev-0b217d3d746233ace52b5dcb26974e929abf62c5.tar.xz
linux-dev-0b217d3d746233ace52b5dcb26974e929abf62c5.zip
ibmvnic: fix kernel build warning in strncpy
drivers/net/ethernet/ibm/ibmvnic.c: In function ‘handle_vpd_rsp’: drivers/net/ethernet/ibm/ibmvnic.c:4393:3: warning: ‘strncpy’ output truncated before terminating nul copying 3 bytes from a string of the same length [-Wstringop-truncation] 4393 | strncpy((char *)adapter->fw_version, "N/A", 3 * sizeof(char)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Lijun Pan <lijunp213@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ibm')
-rw-r--r--drivers/net/ethernet/ibm/ibmvnic.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index d66e15866315..e2630b60c001 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -4385,7 +4385,7 @@ static void handle_vpd_rsp(union ibmvnic_crq *crq,
complete:
if (adapter->fw_version[0] == '\0')
- strncpy((char *)adapter->fw_version, "N/A", 3 * sizeof(char));
+ strscpy((char *)adapter->fw_version, "N/A", sizeof(adapter->fw_version));
complete(&adapter->fw_done);
}