From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754587AbcHSMm6 (ORCPT ); Fri, 19 Aug 2016 08:42:58 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:11141 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752088AbcHSMmy (ORCPT ); Fri, 19 Aug 2016 08:42:54 -0400 X-IronPort-AV: E=Sophos;i="5.28,544,1464645600"; d="scan'208";a="190584901" Date: Fri, 19 Aug 2016 08:41:51 -0400 (EDT) From: Julia Lawall X-X-Sender: jll@hadrien To: Amitoj Kaur Chawla cc: SF Markus Elfring , LKML , Coccinelle , Gilles Muller , Julia Lawall , Michal Marek , Nicolas Palix Subject: Re: [Cocci] [PATCH v3] Coccinelle: Script to replace allocate and memset with zalloc functions In-Reply-To: Message-ID: References: <20160801070233.GA19102@amitoj-Inspiron-3542> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 19 Aug 2016, Amitoj Kaur Chawla wrote: > On Mon, Aug 1, 2016 at 4:53 PM, SF Markus Elfring > wrote: > >> +@vz1 depends on patch && !context && !org && !report@ > >> +type T; > >> +T *d; > >> +statement S; > >> +@@ > >> + > >> + d = > >> +- vmalloc > >> ++ vzalloc > >> + (...); > >> + if (!d) S > >> +- memset(d, 0, sizeof(T)); > >> + > >> +@vz2 depends on patch && !context && !org && !report@ > >> +expression d; > >> +statement S; > >> +@@ > >> + > >> + d = > >> +- vmalloc > >> ++ vzalloc > >> + (...); > >> + if (!d) S > >> +- memset(d, 0, sizeof(*d)); > > > > I suggest to take another look at a few implementation details. > > > > 1. Would it make sense to merge such SmPL rules into one > > so that code duplication could be reduced a bit > > in such a script? > > > > 2. How do you think about to extend the shown check list > > with the function "kvm_kvzalloc"? > > > > Hi Markus, > > kvm_kvzalloc function doesn't fit the same pattern as the other > functions in this semantic patch, and is kvm specific, so the > semantic patch looks fine as is. Acked-by: Julia Lawall > > Thanks, > Amitoj > > > 3. Do you want to maintain a growing (?) function name list manually? > > > > Regards, > > Markus >