driver core: Add __alloc_size hint to devm allocators
authorKees Cook <keescook@chromium.org>
Sat, 29 Oct 2022 07:47:34 +0000 (00:47 -0700)
committerKees Cook <keescook@chromium.org>
Fri, 18 Nov 2022 17:17:13 +0000 (09:17 -0800)
commit74c8e6bffbe10c4470139496f930c0b0752c85c9
treef6f815615a576b96eed8d849340db29664c24684
parent8abfff25b3e2c8f51049295f86dd257492ac1969
driver core: Add __alloc_size hint to devm allocators

Mark the devm_*alloc()-family of allocations with appropriate
__alloc_size()/__realloc_size() hints so the compiler can attempt to
reason about buffer lengths from allocations.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Nishanth Menon <nm@ti.com>
Cc: Michael Kelley <mikelley@microsoft.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Won Chung <wonchung@google.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20221029074734.gonna.276-kees@kernel.org
include/linux/device.h