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/20241101165719.1074234-7-mcanal@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Lance Yang <ioworker0@gmail.com> Cc: Baolin Wang <baolin.wang@linux.alibaba.com> Cc: Barry Song <baohua@kernel.org> Cc: David Hildenbrand <david@redhat.com> Cc: Hugh Dickins <hughd@google.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Ryan Roberts <ryan.roberts@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 24f9cd1 commit 93c1e57

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

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)