lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1207101815580.684@chino.kir.corp.google.com>
Date:	Tue, 10 Jul 2012 18:18:15 -0700 (PDT)
From:	David Rientjes <rientjes@...gle.com>
To:	Arnd Bergmann <arnd@...db.de>
cc:	Pekka Enberg <penberg@...nel.org>,
	Christoph Lameter <cl@...ux.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Matt Mackall <mpm@...enic.com>, linux-mm@...ck.org
Subject: Re: [PATCH] mm/slob: avoid type warning about alignment value

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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ