Skip to content

Commit 939c5de

Browse files
Ye Bintehcaster
authored andcommitted
mm/slab: call kmalloc_noprof() unconditionally in kmalloc_array_noprof()
If 'n' or 'size' isn't builtin constant, we used to call __kmalloc() before commit 7bd230a ("mm/slab: enable slab allocation tagging for kmalloc and friends"), which inadvertedly changed both paths to kmalloc_noprof(). As Harry Yoo points out we can just call kmalloc_noprof() unconditionally. If the compiler knows n and size are constants it doesn't guarantee that bytes will be also seen as constant, and that is the important test in kmalloc_noprof() anyway, so we can just defer to it always. [ [email protected]: change as Harry suggested and adjust commit log ] Fixes: 7bd230a ("mm/slab: enable slab allocation tagging for kmalloc and friends") Signed-off-by: Ye Bin <[email protected]> Reviewed-by: Harry Yoo <[email protected]> Signed-off-by: Vlastimil Babka <[email protected]>
1 parent a6687c8 commit 939c5de

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

include/linux/slab.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -941,8 +941,6 @@ static inline __alloc_size(1, 2) void *kmalloc_array_noprof(size_t n, size_t siz
941941

942942
if (unlikely(check_mul_overflow(n, size, &bytes)))
943943
return NULL;
944-
if (__builtin_constant_p(n) && __builtin_constant_p(size))
945-
return kmalloc_noprof(bytes, flags);
946944
return kmalloc_noprof(bytes, flags);
947945
}
948946
#define kmalloc_array(...) alloc_hooks(kmalloc_array_noprof(__VA_ARGS__))

0 commit comments

Comments
 (0)