diff options
| author | Arnd Bergmann <arnd@arndb.de> | 2012-10-05 10:55:20 -0400 |
|---|---|---|
| committer | Pekka Enberg <penberg@kernel.org> | 2012-10-31 03:24:22 -0400 |
| commit | 789306e5ad6b3051c263ac2478875efa8bc07462 (patch) | |
| tree | 67b8bd1e953dfc46ea830c02622195d0f4000010 | |
| parent | d8843922fba49e887874aa1f9e748d620c5092af (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]
Acked-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
[ penberg@kernel.org: updates for master ]
Signed-off-by: Pekka Enberg <penberg@kernel.org>
| -rw-r--r-- | mm/slob.c | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -428,7 +428,7 @@ static __always_inline void * | |||
| 428 | __do_kmalloc_node(size_t size, gfp_t gfp, int node, unsigned long caller) | 428 | __do_kmalloc_node(size_t size, gfp_t gfp, int node, unsigned long caller) |
| 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; |
| @@ -496,7 +496,7 @@ void kfree(const void *block) | |||
| 496 | 496 | ||
| 497 | sp = virt_to_page(block); | 497 | sp = virt_to_page(block); |
| 498 | if (PageSlab(sp)) { | 498 | if (PageSlab(sp)) { |
| 499 | int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); | 499 | int align = max_t(size_t, ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); |
| 500 | unsigned int *m = (unsigned int *)(block - align); | 500 | unsigned int *m = (unsigned int *)(block - align); |
| 501 | slob_free(m, *m + align); | 501 | slob_free(m, *m + align); |
| 502 | } else | 502 | } else |
| @@ -519,7 +519,7 @@ size_t ksize(const void *block) | |||
| 519 | if (unlikely(!PageSlab(sp))) | 519 | if (unlikely(!PageSlab(sp))) |
| 520 | return PAGE_SIZE << compound_order(sp); | 520 | return PAGE_SIZE << compound_order(sp); |
| 521 | 521 | ||
| 522 | align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); | 522 | align = max_t(size_t, ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); |
| 523 | m = (unsigned int *)(block - align); | 523 | m = (unsigned int *)(block - align); |
| 524 | return SLOB_UNITS(*m) * SLOB_UNIT; | 524 | return SLOB_UNITS(*m) * SLOB_UNIT; |
| 525 | } | 525 | } |
