mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 03:53:37 +02:00
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: https://github.com/KSPP/linux/issues/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>
This commit is contained in:
parent
24f9cd195f
commit
93c1e57ade
|
|
@ -969,7 +969,7 @@ static int __init setup_thp_anon(char *str)
|
|||
|
||||
if (!str || strlen(str) + 1 > PAGE_SIZE)
|
||||
goto err;
|
||||
strcpy(str_dup, str);
|
||||
strscpy(str_dup, str);
|
||||
|
||||
always = huge_anon_orders_always;
|
||||
madvise = huge_anon_orders_madvise;
|
||||
|
|
@ -4167,7 +4167,7 @@ static ssize_t split_huge_pages_write(struct file *file, const char __user *buf,
|
|||
|
||||
tok = strsep(&buf, ",");
|
||||
if (tok) {
|
||||
strcpy(file_path, tok);
|
||||
strscpy(file_path, tok);
|
||||
} else {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user