From mboxrd@z Thu Jan 1 00:00:00 1970 From: SF Markus Elfring Subject: Re: Replacing specific kmalloc() calls by kmalloc_array()? Date: Wed, 24 Aug 2016 14:10:13 +0200 Message-ID: References: <82b84c9c-38a4-4d17-910f-312668dbae01@users.sourceforge.net> <033d8595-d051-1fa8-95b1-5d2056eb5667@users.sourceforge.net> <57B562F3.1080004@bfs.de> <9db1986a-9b93-72ca-f35e-85b5b5e9f351@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <9db1986a-9b93-72ca-f35e-85b5b5e9f351@redhat.com> Sender: kernel-janitors-owner@vger.kernel.org List-Archive: List-Post: To: Paolo Bonzini Cc: Julia Lawall , walter harms , kvm@vger.kernel.org, linux-s390@vger.kernel.org, =?UTF-8?Q?Christian_Borntr=c3=a4ger?= , Cornelia Huck , David Hildenbrand , Heiko Carstens , Martin Schwidefsky , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , LKML , kernel-janitors@vger.kernel.org List-ID: > Or kmalloc_array, since zeroing is not necessary. Might be an idea for > a new Coccinelle script, like > > - kmalloc (N * sizeof T, GFP) > + kmalloc_array(N, sizeof T, GFP) I have picked your idea up. The corresponding script for the semantic patch language became longer than your general suggestion (if additional source code control flow aspects are integrated). Would it make sense to check any more function combinations in a similar way? Regards, Markus