]> git.baikalelectronics.ru Git - kernel.git/commit
f2fs: Replace strncpy with memcpy
authorGuenter Roeck <linux@roeck-us.net>
Sun, 1 Jul 2018 20:57:06 +0000 (13:57 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Sun, 29 Jul 2018 01:26:08 +0000 (18:26 -0700)
commit9180b3a6ceabb51c1f71b1c25360e116127ffdd1
tree1da1110a19fa68d81cee479a830cba13750a22e8
parente3efd47fc0aa37de949287d32b80257cc3e7adc2
f2fs: Replace strncpy with memcpy

gcc 8.1.0 complains:

fs/f2fs/namei.c: In function 'f2fs_update_extension_list':
fs/f2fs/namei.c:257:3: warning:
'strncpy' output truncated before terminating nul copying
as many bytes from a string as its length
fs/f2fs/namei.c:249:3: warning:
'strncpy' output truncated before terminating nul copying
as many bytes from a string as its length

Using strncpy() is indeed less than perfect since the length of data to
be copied has already been determined with strlen(). Replace strncpy()
with memcpy() to address the warning and optimize the code a little.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/namei.c