* [PATCH] parse_options(): replace deprecated strcpy with strscpy
@ 2024-11-06 2:58 Daniel Yang
2024-11-08 9:46 ` Chao Yu
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Yang @ 2024-11-06 2:58 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>
---
fs/f2fs/super.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 87ab5696b..ee8861b95 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1158,7 +1158,7 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
break;
}
- strcpy(ext[ext_cnt], name);
+ strscpy(ext[ext_cnt], name);
F2FS_OPTION(sbi).compress_ext_cnt++;
kfree(name);
break;
@@ -1187,7 +1187,7 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
break;
}
- strcpy(noext[noext_cnt], name);
+ strscpy(noext[noext_cnt], name);
F2FS_OPTION(sbi).nocompress_ext_cnt++;
kfree(name);
break;
--
2.39.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] parse_options(): replace deprecated strcpy with strscpy
2024-11-06 2:58 [PATCH] parse_options(): replace deprecated strcpy with strscpy Daniel Yang
@ 2024-11-08 9:46 ` Chao Yu
2024-11-09 1:40 ` Daniel Yang
0 siblings, 1 reply; 3+ messages in thread
From: Chao Yu @ 2024-11-08 9:46 UTC (permalink / raw)
To: Daniel Yang, Jaegeuk Kim, open list:F2FS FILE SYSTEM, open list; +Cc: Chao Yu
On 2024/11/6 10:58, 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.
It's better to add "f2fs: " prefix for commit title.
>
> Signed-off-by: Daniel Yang <danielyangkang@gmail.com>
> ---
> fs/f2fs/super.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index 87ab5696b..ee8861b95 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -1158,7 +1158,7 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
> break;
> }
>
> - strcpy(ext[ext_cnt], name);
> + strscpy(ext[ext_cnt], name);
Needs to handle return value of strscpy()?
> F2FS_OPTION(sbi).compress_ext_cnt++;
> kfree(name);
> break;
> @@ -1187,7 +1187,7 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
> break;
> }
>
> - strcpy(noext[noext_cnt], name);
> + strscpy(noext[noext_cnt], name);
Ditto,
Thanks,
> F2FS_OPTION(sbi).nocompress_ext_cnt++;
> kfree(name);
> break;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] parse_options(): replace deprecated strcpy with strscpy
2024-11-08 9:46 ` Chao Yu
@ 2024-11-09 1:40 ` Daniel Yang
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Yang @ 2024-11-09 1:40 UTC (permalink / raw)
To: Chao Yu; +Cc: Jaegeuk Kim, open list:F2FS FILE SYSTEM, open list
On Fri, Nov 8, 2024 at 1:47 AM Chao Yu <chao@kernel.org> wrote:
>
> On 2024/11/6 10:58, 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.
>
> It's better to add "f2fs: " prefix for commit title.
>
> >
> > Signed-off-by: Daniel Yang <danielyangkang@gmail.com>
> > ---
> > fs/f2fs/super.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> > index 87ab5696b..ee8861b95 100644
> > --- a/fs/f2fs/super.c
> > +++ b/fs/f2fs/super.c
> > @@ -1158,7 +1158,7 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
> > break;
> > }
> >
> > - strcpy(ext[ext_cnt], name);
> > + strscpy(ext[ext_cnt], name);
>
> Needs to handle return value of strscpy()?
>
> > F2FS_OPTION(sbi).compress_ext_cnt++;
> > kfree(name);
> > break;
> > @@ -1187,7 +1187,7 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
> > break;
> > }
> >
> > - strcpy(noext[noext_cnt], name);
> > + strscpy(noext[noext_cnt], name);
>
> Ditto,
>
> Thanks,
>
> > F2FS_OPTION(sbi).nocompress_ext_cnt++;
> > kfree(name);
> > break;
>
Ok, I've added the changes and sent a v2 of the patch. Lmk if there's
any other issues.
- Daniel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-09 1:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-06 2:58 [PATCH] parse_options(): replace deprecated strcpy with strscpy Daniel Yang
2024-11-08 9:46 ` Chao Yu
2024-11-09 1:40 ` Daniel Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox