summaryrefslogtreecommitdiffstats
path: root/include/linux/compiler_types.h
diff options
context:
space:
mode:
authorVlastimil Babka <vbabka@suse.cz>2022-09-29 11:30:55 +0200
committerVlastimil Babka <vbabka@suse.cz>2022-09-29 11:30:55 +0200
commit445d41d7a7c15793933f47c0c23fae3a1d09a8c1 (patch)
tree2621791892a2cc5b2df5e762af3843ae47453254 /include/linux/compiler_types.h
parentaf961f8059a42d1b9941dd8aa83420b25fd17e91 (diff)
parent05a940656e1eb2026d9ee31019d5b47e9545124d (diff)
downloadlinux-445d41d7a7c15793933f47c0c23fae3a1d09a8c1.tar.gz
linux-445d41d7a7c15793933f47c0c23fae3a1d09a8c1.tar.bz2
linux-445d41d7a7c15793933f47c0c23fae3a1d09a8c1.zip
Merge branch 'slab/for-6.1/kmalloc_size_roundup' into slab/for-next
The first two patches from a series by Kees Cook [1] that introduce kmalloc_size_roundup(). This will allow merging of per-subsystem patches using the new function and ultimately stop (ab)using ksize() in a way that causes ongoing trouble for debugging functionality and static checkers. [1] https://lore.kernel.org/all/20220923202822.2667581-1-keescook@chromium.org/ -- Resolved a conflict of modifying mm/slab.c __ksize() comment with a commit that unifies __ksize() implementation into mm/slab_common.c
Diffstat (limited to 'include/linux/compiler_types.h')
-rw-r--r--include/linux/compiler_types.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index 4f2a819fd60a..0717534f8364 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -271,14 +271,16 @@ struct ftrace_likely_data {
/*
* Any place that could be marked with the "alloc_size" attribute is also
- * a place to be marked with the "malloc" attribute. Do this as part of the
- * __alloc_size macro to avoid redundant attributes and to avoid missing a
- * __malloc marking.
+ * a place to be marked with the "malloc" attribute, except those that may
+ * be performing a _reallocation_, as that may alias the existing pointer.
+ * For these, use __realloc_size().
*/
#ifdef __alloc_size__
# define __alloc_size(x, ...) __alloc_size__(x, ## __VA_ARGS__) __malloc
+# define __realloc_size(x, ...) __alloc_size__(x, ## __VA_ARGS__)
#else
# define __alloc_size(x, ...) __malloc
+# define __realloc_size(x, ...)
#endif
#ifndef asm_volatile_goto