devres: Use kmalloc_size_roundup() to match ksize() usage

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2178302

commit 6fcd7e702d3d91cc2c3194acffd7d67b2c10b81f
Author: Kees Cook <keescook@chromium.org>
Date: Tue, 18 Oct 2022 02:04:10 -0700

Round up allocations with kmalloc_size_roundup() so that devres's use
of ksize() is always accurate and no special handling of the memory is
needed by KASAN, UBSAN_BOUNDS, nor FORTIFY_SOURCE.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20221018090406.never.856-kees@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
This commit is contained in:
Mark Langsdorf 2023-03-14 15:54:30 -04:00
parent 0cd7830c56
commit df88d53c3b
1 changed files with 3 additions and 0 deletions

View File

@ -101,6 +101,9 @@ static bool check_dr_size(size_t size, size_t *tot_size)
size, tot_size)))
return false;
/* Actually allocate the full kmalloc bucket size. */
*tot_size = kmalloc_size_roundup(*tot_size);
return true;
}