f2fs: replace deprecated strcpy with strscpy
PATCH v3 1/1 f2fs: replace deprecated strcpy with strscpy
strcpy is deprecated. Kernel docs recommend replacing strcpy with strscpy. The function strcpy() return value isn't used so there shouldn't be an issue replacing with the safer alternative strscpy.
---
v2 -> v3: store strscpy result in ret and return ret if error v1 -> v2: handle strscpy errors, changed prefix to f2fs
fs/f2fs/super.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
fs/f2fs/super.c +10 -2
@@ -1158,7 +1158,11 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)break ; } -strcpy (ext[ext_cnt], name); + ret =strscpy (ext[ext_cnt], name); +if (ret <0 ) { +kfree (name); +return ret; + }F2FS_OPTION (sbi).compress_ext_cnt++;kfree (name);break ;
@@ -1187,7 +1191,11 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)break ; } -strcpy (noext[noext_cnt], name); + ret =strscpy (noext[noext_cnt], name); +if (ret <0 ) { +kfree (name); +return ret; + }F2FS_OPTION (sbi).nocompress_ext_cnt++;kfree (name);break ;
Signature · 1 line
2.39.5
Quoted 5 lines · Daniel Yang
strcpy is deprecated. Kernel docs recommend replacing strcpy with strscpy. The function
strcpy()return value isn't used so there shouldn't be an issue replacing with the safer alternative strscpy.Signed-off-by Daniel Yang <[email protected]>
Thanks,
This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <[email protected]>:
Hello:
This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:
Quoted 10 lines · On Sun, 17 Nov 2024 23:01:40 -0800 you wrote:
strcpy is deprecated. Kernel docs recommend replacing strcpy with strscpy. The function
strcpy()return value isn't used so there shouldn't be an issue replacing with the safer alternative strscpy.Signed-off-by Daniel Yang <[email protected]>---
v2 -> v3: store strscpy result in ret and return ret if error v1 -> v2: handle strscpy errors, changed prefix to f2fsfs/f2fs/super.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
Here is the summary with links:
- [f2fs-dev,v3] f2fs: replace deprecated strcpy with strscpy
https://git.kernel.org/jaegeuk/f2fs/c/789ca0eb47f7
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html