diff options
author | Wang Xiayang <xywang.sjtu@sjtu.edu.cn> | 2019-07-31 16:15:42 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-08-02 17:57:18 -0700 |
commit | 3690c8c9a8edff0db077a38783112d8fe12a7dd2 (patch) | |
tree | c8f99e8488c5ebf0032bd458e87dde01ccf5fc4e /drivers | |
parent | ea443e5e98b5b74e317ef3d26bcaea54931ccdee (diff) | |
download | linux-3690c8c9a8edff0db077a38783112d8fe12a7dd2.tar.bz2 |
net/ethernet/qlogic/qed: force the string buffer NULL-terminated
strncpy() does not ensure NULL-termination when the input string
size equals to the destination buffer size 30.
The output string is passed to qed_int_deassertion_aeu_bit()
which calls DP_INFO() and relies NULL-termination.
Use strlcpy instead. The other conditional branch above strncpy()
needs no fix as snprintf() ensures NULL-termination.
This issue is identified by a Coccinelle script.
Signed-off-by: Wang Xiayang <xywang.sjtu@sjtu.edu.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/qlogic/qed/qed_int.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/qlogic/qed/qed_int.c b/drivers/net/ethernet/qlogic/qed/qed_int.c index 4e8118a08654..9f5113639eaf 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_int.c +++ b/drivers/net/ethernet/qlogic/qed/qed_int.c @@ -1093,7 +1093,7 @@ static int qed_int_deassertion(struct qed_hwfn *p_hwfn, snprintf(bit_name, 30, p_aeu->bit_name, num); else - strncpy(bit_name, + strlcpy(bit_name, p_aeu->bit_name, 30); /* We now need to pass bitmask in its |