Skip to content

Commit 93c1e57

Browse files
mairacanalakpm00
authored andcommitted
mm: huge_memory: use strscpy() instead of strcpy()
Replace strcpy() with strscpy() in mm/huge_memory.c strcpy() has been deprecated because it is generally unsafe, so help to eliminate it from the kernel source. Link: KSPP#88 Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Maíra Canal <[email protected]> Reviewed-by: Lance Yang <[email protected]> Cc: Baolin Wang <[email protected]> Cc: Barry Song <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Ryan Roberts <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 24f9cd1 commit 93c1e57

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mm/huge_memory.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ static int __init setup_thp_anon(char *str)
969969

970970
if (!str || strlen(str) + 1 > PAGE_SIZE)
971971
goto err;
972-
strcpy(str_dup, str);
972+
strscpy(str_dup, str);
973973

974974
always = huge_anon_orders_always;
975975
madvise = huge_anon_orders_madvise;
@@ -4167,7 +4167,7 @@ static ssize_t split_huge_pages_write(struct file *file, const char __user *buf,
41674167

41684168
tok = strsep(&buf, ",");
41694169
if (tok) {
4170-
strcpy(file_path, tok);
4170+
strscpy(file_path, tok);
41714171
} else {
41724172
ret = -EINVAL;
41734173
goto out;

0 commit comments

Comments
 (0)