]> www.infradead.org Git - nvme.git/commit
string: Add additional __realloc_size() annotations for "dup" helpers
authorKees Cook <keescook@chromium.org>
Wed, 1 May 2024 23:32:02 +0000 (16:32 -0700)
committerKees Cook <keescook@chromium.org>
Thu, 2 May 2024 14:52:41 +0000 (07:52 -0700)
commit7d78a77733552092361239b1d8afaf8412f5dffd
treef62f10bfeaa844e17e24fe5dac1f17a5a090324a
parent74df22453c51392476117d7330bf02cee6e987cf
string: Add additional __realloc_size() annotations for "dup" helpers

Several other "dup"-style interfaces could use the __realloc_size()
attribute. (As a reminder to myself and others: "realloc" is used here
instead of "alloc" because the "alloc_size" attribute implies that the
memory contents are uninitialized. Since we're copying contents into the
resulting allocation, it must use "realloc_size" to avoid confusing the
compiler's optimization passes.)

Add KUnit test coverage where possible. (KUnit still does not have the
ability to manipulate userspace memory.)

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20240502145218.it.729-kees@kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
include/linux/string.h
lib/fortify_kunit.c