Skip to content

Commit 789ca0e

Browse files
danieltherealyangJaegeuk Kim
authored andcommitted
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 <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent acff940 commit 789ca0e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

fs/f2fs/super.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,11 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
11721172
break;
11731173
}
11741174

1175-
strcpy(ext[ext_cnt], name);
1175+
ret = strscpy(ext[ext_cnt], name);
1176+
if (ret < 0) {
1177+
kfree(name);
1178+
return ret;
1179+
}
11761180
F2FS_OPTION(sbi).compress_ext_cnt++;
11771181
kfree(name);
11781182
break;
@@ -1201,7 +1205,11 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
12011205
break;
12021206
}
12031207

1204-
strcpy(noext[noext_cnt], name);
1208+
ret = strscpy(noext[noext_cnt], name);
1209+
if (ret < 0) {
1210+
kfree(name);
1211+
return ret;
1212+
}
12051213
F2FS_OPTION(sbi).nocompress_ext_cnt++;
12061214
kfree(name);
12071215
break;

0 commit comments

Comments
 (0)