From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757966AbcIGQhK (ORCPT ); Wed, 7 Sep 2016 12:37:10 -0400 Received: from smtprelay0240.hostedemail.com ([216.40.44.240]:36415 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757923AbcIGQhG (ORCPT ); Wed, 7 Sep 2016 12:37:06 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1537:1567:1593:1594:1711:1714:1730:1747:1777:1792:2393:2559:2562:2693:2828:3138:3139:3140:3141:3142:3622:3865:3866:3867:3868:3871:4321:5007:6119:7903:8603:10004:10400:10848:11232:11658:11914:12114:12296:12740:13069:13311:13357:13439:14659:14721:21080:30054:30064:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:7,LUA_SUMMARY:none X-HE-Tag: drain55_204a2f522e34f X-Filterd-Recvd-Size: 1968 Message-ID: <1473266220.29864.17.camel@perches.com> Subject: Re: x86-ksysfs: Use kmalloc_array() in create_setup_data_nodes() From: Joe Perches To: Kees Cook , SF Markus Elfring Cc: Paolo Bonzini , Ingo Molnar , "x86@kernel.org" , Dave Young , "H. Peter Anvin" , Matt Fleming , Thomas Gleixner , LKML , kernel-janitors@vger.kernel.org, Julia Lawall Date: Wed, 07 Sep 2016 09:37:00 -0700 In-Reply-To: References: <3b21b2d7-9856-009c-9bd1-3a76a83bc7fc@users.sourceforge.net> <3eea073a-b271-54b7-1eec-e841e0f4bdf9@redhat.com> <07f2cb49-662f-590f-acf6-686f8432015d@users.sourceforge.net> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.21.91-0ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2016-09-07 at 09:23 -0700, Kees Cook wrote: > Fixing these kmalloc calls would be a nice thing to clean up > everywhere. Dubious as gcc cannot currently optimize known small fixed size allocations with alloc_array and will always perform the multiplication. Also the style of sizeof(*ptr) is not always as clear, obvious nor as easy to grep as sizeof(type).