From: David Rientjes <rientjes@google.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Pekka Enberg <penberg@kernel.org>,
Christoph Lameter <cl@linux.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Matt Mackall <mpm@selenic.com>,
linux-mm@kvack.org
Subject: Re: [PATCH] mm/slob: avoid type warning about alignment value
Date: Tue, 10 Jul 2012 18:18:15 -0700 (PDT) [thread overview]
Message-ID: <alpine.DEB.2.00.1207101815580.684@chino.kir.corp.google.com> (raw)
In-Reply-To: <201207102055.35278.arnd@arndb.de>
On Tue, 10 Jul 2012, Arnd Bergmann wrote:
> diff --git a/mm/slob.c b/mm/slob.c
> index 95d1c7d..51d6a27 100644
> --- a/mm/slob.c
> +++ b/mm/slob.c
> @@ -426,7 +426,7 @@ out:
> void *__kmalloc_node(size_t size, gfp_t gfp, int node)
> {
> unsigned int *m;
> - int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
> + int align = max_t(size_t, ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
> void *ret;
>
> gfp &= gfp_allowed_mask;
> @@ -479,7 +479,7 @@ void kfree(const void *block)
>
> sp = virt_to_page(block);
> if (PageSlab(sp)) {
> - int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
> + int align = max_t(size_t, ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
> unsigned int *m = (unsigned int *)(block - align);
> slob_free(m, *m + align);
> } else
> @@ -498,7 +498,7 @@ size_t ksize(const void *block)
>
> sp = virt_to_page(block);
> if (PageSlab(sp)) {
> - int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
> + int align = max_t(size_t, ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
> unsigned int *m = (unsigned int *)(block - align);
> return SLOB_UNITS(*m) * SLOB_UNIT;
> } else
Wouldn't it be better to avoid this problem more generally by casting the
__alignof__ for ARCH_{KMALLOC,SLAB}_MINALIGN to int in slab.h? All
architectures that define these themselves will be using plain integers,
the problem is __alignof__ returning size_t when undefined.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-07-11 1:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-10 20:55 Arnd Bergmann
2012-07-11 1:18 ` David Rientjes [this message]
2012-07-11 6:39 ` Arnd Bergmann
2012-07-11 20:42 ` David Rientjes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.00.1207101815580.684@chino.kir.corp.google.com \
--to=rientjes@google.com \
--cc=arnd@arndb.de \
--cc=cl@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mpm@selenic.com \
--cc=penberg@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox