Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752579AbdI0I4p (ORCPT ); Wed, 27 Sep 2017 04:56:45 -0400 Received: from resqmta-ch2-03v.sys.comcast.net ([69.252.207.35]:39342 "EHLO resqmta-ch2-03v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752545AbdI0I4m (ORCPT ); Wed, 27 Sep 2017 04:56:42 -0400 Date: Wed, 27 Sep 2017 03:56:40 -0500 (CDT) From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Johannes Thumshirn cc: Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Damien Le Moal , Christoph Hellwig Subject: Re: [PATCH 1/6] mm: add kmalloc_array_node and kcalloc_node In-Reply-To: <20170927082038.3782-2-jthumshirn@suse.de> Message-ID: References: <20170927082038.3782-1-jthumshirn@suse.de> <20170927082038.3782-2-jthumshirn@suse.de> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CMAE-Envelope: MS4wfC0JGzk2T0PZm+iCIeak89ngHtJpbHoqYkYtKA1VDnU/my4L6zhVXvY6XvMiWnj/ymL5VoCdeJTQYgruH4SKfQYpWXQ+I2DKT+dRblrCto9OWlHZdDfu iTIiog1LpWx9DGQ8lopsaP+yx3TVNqqN4Tdz9cRBJWuOeNAcrUsntNpH5w0iYN9vmHYznweZQExNZoZm4yL2xbZfx/yvmtXVB06n7u+0bqrEX3+pTJZiLGHY wYYHk3PuApLmScWDK6adACoxcJTi84f4k0RcRL0ZHrStdrwURbbx704quwSttAGAUbLuBcjY/YDDZHXX+WxDJatlX5tW8/zwr6xy+zKqQe63aLmuJnaElPWF xqR1zTbgU54rhR9e5LBlNF1p+1yLFBwcgtLrpQRfUBM3uZ6SKn9rI8V+4GnPKCwSWr1KwEBm Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 443 Lines: 12 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.