diff options
author | Jason Wang <wangborong@cdjrlc.com> | 2021-08-07 10:21:54 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2022-05-04 12:37:44 +0300 |
commit | a2ece1f512959258f29a11909d23a44fc95edf97 (patch) | |
tree | c99e2e9a51b5b68b47ac34067c985ddd160dee90 /drivers | |
parent | 76c452b494b8be58a1965ab93b7002f295f7705a (diff) | |
download | linux-a2ece1f512959258f29a11909d23a44fc95edf97.tar.xz |
powerpc: use strscpy to replace strlcpy
The strlcpy should not be used because it doesn't limit the source
length. As linus says, it's a completely useless function if you
can't implicitly trust the source string - but that is almost always
why people think they should use it! All in all the BSD function
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, We prefer using strscpy instead of strlcpy.
Signed-off-by: Jason Wang <wangborong@cdjrlc.com>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210807072154.64512-1-wangborong@cdjrlc.com
Diffstat (limited to 'drivers')
0 files changed, 0 insertions, 0 deletions