aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-11-07 21:17:06 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-11-07 21:17:06 -0500
commit29e27cc49234571477c9840a7112270069553abc (patch)
tree6d0496744e10852a684327bfc8b4fec9680209b7
parentd6d1d8e5193d87c0133594ca65b10b24de8e7130 (diff)
downloadbcachefs-tools-29e27cc49234571477c9840a7112270069553abc.tar.gz
Fix build on 32 bit
size_t is apparently not an unsigned long on 32 bit, which is what rounddown_pow_of_two() returns. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--include/linux/slab.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 25ccf1a7..ca0c7934 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -27,7 +27,8 @@ static inline void *kmalloc_noprof(size_t size, gfp_t flags)
for (i = 0; i < 10; i++) {
if (size) {
- size_t alignment = min(rounddown_pow_of_two(size), (size_t)PAGE_SIZE);
+ size_t alignment = min_t(size_t, PAGE_SIZE,
+ rounddown_pow_of_two(size));
alignment = max(sizeof(void *), alignment);
if (posix_memalign(&p, alignment, size))
p = NULL;