]> git.sesse.net Git - bcachefs-tools-debian/commitdiff
Fix build on 32 bit
authorKent Overstreet <kent.overstreet@linux.dev>
Wed, 8 Nov 2023 02:17:06 +0000 (21:17 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Wed, 8 Nov 2023 02:17:06 +0000 (21:17 -0500)
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>
include/linux/slab.h

index 25ccf1a742049bebcac5a1d87a9340cb8f34a477..ca0c7934d3bbc0443e54b52e188dfd6d87d3d6c9 100644 (file)
@@ -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;