]> git.baikalelectronics.ru Git - kernel.git/commit
ath10k: replace strlcpy with strscpy
authorJason Wang <wangborong@cdjrlc.com>
Tue, 21 Dec 2021 10:04:20 +0000 (12:04 +0200)
committerKalle Valo <quic_kvalo@quicinc.com>
Wed, 22 Dec 2021 06:02:08 +0000 (08:02 +0200)
commit8aacac8bc669f56305030c8061550805a170a76f
tree28be373f90896f77f07f03de3ace51b1a651fcec
parent266354f737cbbe5c38357cbaf5d93d7eb141d910
ath10k: replace strlcpy with strscpy

The strlcpy should not be used because it doesn't limit the source
length. So that it will lead some potential bugs.

But the strscpy doesn't require reading memory from the src string
beyond the specified "count" bytes, and since the return value is
easier to error-check than strlcpy()'s. In addition, the implementation
is robust to the string changing out from underneath it, unlike the
current strlcpy() implementation.

Thus, replace strlcpy with strscpy.

Signed-off-by: Jason Wang <wangborong@cdjrlc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20211221070931.725720-1-wangborong@cdjrlc.com
drivers/net/wireless/ath/ath10k/coredump.c