]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
mm/thp: fix strncpy warning
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Thu, 1 Jul 2021 01:52:11 +0000 (18:52 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 1 Jul 2021 03:47:30 +0000 (20:47 -0700)
commit1212e00c93a8016dfd70d209f428f8e0edd5856f
treeeed4577633da13458a38097d629ab3bfcf534596
parent36af67370e33db2ec48693dd20d6b3cd049e07af
mm/thp: fix strncpy warning

Using MAX_INPUT_BUF_SZ as the maximum length of the string makes fortify
complain as it thinks the string might be longer than the buffer, and if
it is, we will end up with a "string" that is missing a NUL terminator.
It's trivial to show that 'tok' points to a NUL-terminated string which is
less than MAX_INPUT_BUF_SZ in length, so we may as well just use strcpy()
and avoid the warning.

Link: https://lkml.kernel.org/r/20210615200242.1716568-4-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/huge_memory.c