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.

Signed-off-by: Daniel Yang <danielyangkang@gmail.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Daniel Yang 2024-11-17 23:01:40 -08:00 committed by Jaegeuk Kim
parent acff9409dd
commit 789ca0eb47

View file

@ -1172,7 +1172,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;
@ -1201,7 +1205,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;