diff options
author | Arnd Bergmann <arnd@arndb.de> | 2012-08-05 11:00:58 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-10-09 15:56:28 -0400 |
commit | baaf1dd491433a78826150aff7411015de7e9b65 (patch) | |
tree | fc5430d64c1f8ec43797d70a72e9d5500615cfcd | |
parent | 48968177312e01737c018fdb2430b703831cbc2e (diff) |
mm/slob: use min_t() to compare ARCH_SLAB_MINALIGN
The definition of ARCH_SLAB_MINALIGN is architecture dependent
and can be either of type size_t or int. Comparing that value
with ARCH_KMALLOC_MINALIGN can cause harmless warnings on
platforms where they are different. Since both are always
small positive integer numbers, using the size_t type to compare
them is safe and gets rid of the warning.
Without this patch, building ARM collie_defconfig results in:
mm/slob.c: In function '__kmalloc_node':
mm/slob.c:431:152: warning: comparison of distinct pointer types lacks a cast [enabled by default]
mm/slob.c: In function 'kfree':
mm/slob.c:484:153: warning: comparison of distinct pointer types lacks a cast [enabled by default]
mm/slob.c: In function 'ksize':
mm/slob.c:503:153: warning: comparison of distinct pointer types lacks a cast [enabled by default]
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
-rw-r--r-- | mm/slob.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -428,7 +428,7 @@ out: | |||
428 | void *__kmalloc_node(size_t size, gfp_t gfp, int node) | 428 | void *__kmalloc_node(size_t size, gfp_t gfp, int node) |
429 | { | 429 | { |
430 | unsigned int *m; | 430 | unsigned int *m; |
431 | int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); | 431 | int align = max_t(size_t, ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); |
432 | void *ret; | 432 | void *ret; |
433 | 433 | ||
434 | gfp &= gfp_allowed_mask; | 434 | gfp &= gfp_allowed_mask; |
@@ -481,7 +481,7 @@ void kfree(const void *block) | |||
481 | 481 | ||
482 | sp = virt_to_page(block); | 482 | sp = virt_to_page(block); |
483 | if (PageSlab(sp)) { | 483 | if (PageSlab(sp)) { |
484 | int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); | 484 | int align = max_t(size_t, ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); |
485 | unsigned int *m = (unsigned int *)(block - align); | 485 | unsigned int *m = (unsigned int *)(block - align); |
486 | slob_free(m, *m + align); | 486 | slob_free(m, *m + align); |
487 | } else | 487 | } else |
@@ -500,7 +500,7 @@ size_t ksize(const void *block) | |||
500 | 500 | ||
501 | sp = virt_to_page(block); | 501 | sp = virt_to_page(block); |
502 | if (PageSlab(sp)) { | 502 | if (PageSlab(sp)) { |
503 | int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); | 503 | int align = max_t(size_t, ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); |
504 | unsigned int *m = (unsigned int *)(block - align); | 504 | unsigned int *m = (unsigned int *)(block - align); |
505 | return SLOB_UNITS(*m) * SLOB_UNIT; | 505 | return SLOB_UNITS(*m) * SLOB_UNIT; |
506 | } else | 506 | } else |