From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034316AbdEYKfq (ORCPT ); Thu, 25 May 2017 06:35:46 -0400 Received: from smtprelay0094.hostedemail.com ([216.40.44.94]:36402 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1032713AbdEYKfo (ORCPT ); Thu, 25 May 2017 06:35:44 -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:1561:1593:1594:1711:1714:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3622:3865:3867:3871:4321:5007:7904:10004:10400:10848:11232:11658:11914:12114:12740:12760:12895:13069:13161:13229:13255:13311:13357:13439:14659:14721:21080:21627:30012:30054:30070:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: boat46_4e2525b84772b X-Filterd-Recvd-Size: 1311 Message-ID: <1495708535.29207.1.camel@perches.com> Subject: Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form From: Joe Perches To: Alexey Dobriyan , Andrew Morton Cc: Linux Kernel Date: Thu, 25 May 2017 03:35:35 -0700 In-Reply-To: References: <20170522213837.GA13861@avx2> <1495489398.2093.48.camel@perches.com> <20170522152227.52a9a7c48e8141056fc612c4@linux-foundation.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 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, 2017-05-24 at 13:18 +0300, Alexey Dobriyan wrote: > Proper fix is to introduce typed allocation macros with the following > signatures: > > T* lmalloc(T, gfp); [] > struct foo *x; > x = lmalloc(struct foo, GFP_KERNEL); Then code would be written x = lmalloc(typeof(*x), GFP_KERNEL);