* [PATCH v3] f2fs: replace deprecated strcpy with strscpy
@ 2024-11-18 7:01 Daniel Yang
2024-11-18 8:14 ` Chao Yu
2024-11-21 16:20 ` [f2fs-dev] " patchwork-bot+f2fs
0 siblings, 2 replies; 3+ messages in thread
From: Daniel Yang @ 2024-11-18 7:01 UTC (permalink / raw)
To: Jaegeuk Kim, Chao Yu, open list:F2FS FILE SYSTEM, open list; +Cc: 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 <danielyangkang@gmail.com>
---
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(-)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 87ab5696b..3eb754547 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -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;
--
2.39.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3] f2fs: replace deprecated strcpy with strscpy
2024-11-18 7:01 [PATCH v3] f2fs: replace deprecated strcpy with strscpy Daniel Yang
@ 2024-11-18 8:14 ` Chao Yu
2024-11-21 16:20 ` [f2fs-dev] " patchwork-bot+f2fs
1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu @ 2024-11-18 8:14 UTC (permalink / raw)
To: Daniel Yang, Jaegeuk Kim, open list:F2FS FILE SYSTEM, open list; +Cc: Chao Yu
On 2024/11/18 15:01, Daniel Yang 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 <danielyangkang@gmail.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [f2fs-dev] [PATCH v3] f2fs: replace deprecated strcpy with strscpy
2024-11-18 7:01 [PATCH v3] f2fs: replace deprecated strcpy with strscpy Daniel Yang
2024-11-18 8:14 ` Chao Yu
@ 2024-11-21 16:20 ` patchwork-bot+f2fs
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+f2fs @ 2024-11-21 16:20 UTC (permalink / raw)
To: Daniel Yang; +Cc: jaegeuk, chao, linux-f2fs-devel, linux-kernel
Hello:
This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:
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 <danielyangkang@gmail.com>
> ---
> 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(-)
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-21 16:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-18 7:01 [PATCH v3] f2fs: replace deprecated strcpy with strscpy Daniel Yang
2024-11-18 8:14 ` Chao Yu
2024-11-21 16:20 ` [f2fs-dev] " patchwork-bot+f2fs
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox