[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1709270355400.30866@nuc-kabylake>
Date: Wed, 27 Sep 2017 03:56:40 -0500 (CDT)
From: Christopher Lameter <cl@...ux.com>
To: Johannes Thumshirn <jthumshirn@...e.de>
cc: Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Damien Le Moal <damien.lemoal@....com>,
Christoph Hellwig <hch@....de>
Subject: Re: [PATCH 1/6] mm: add kmalloc_array_node and kcalloc_node
On Wed, 27 Sep 2017, Johannes Thumshirn wrote:
> +static inline void *kmalloc_array_node(size_t n, size_t size, gfp_t flags,
> + int node)
> +{
> + if (size != 0 && n > SIZE_MAX / size)
> + return NULL;
> + if (__builtin_constant_p(n) && __builtin_constant_p(size))
> + return kmalloc_node(n * size, flags, node);
Isnt the same check done by kmalloc_node already? The result of
multiplying two constants is a constant after all.
Powered by blists - more mailing lists