From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753710AbcHAMqy (ORCPT ); Mon, 1 Aug 2016 08:46:54 -0400 Received: from mout.web.de ([212.227.15.4]:59471 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753480AbcHAMqR (ORCPT ); Mon, 1 Aug 2016 08:46:17 -0400 Subject: Re: [Cocci] [PATCH v3] Coccinelle: Script to replace allocate and memset with zalloc functions To: Julia Lawall References: <20160801070233.GA19102@amitoj-Inspiron-3542> <0dbd2dd6-4c68-1f7c-1500-9e5d40047813@users.sourceforge.net> Cc: Amitoj Kaur Chawla , LKML , Coccinelle , Gilles Muller , Michal Marek , Nicolas Palix From: SF Markus Elfring Message-ID: <0cdfaa73-d2ba-acc3-523f-559f14fadbc1@users.sourceforge.net> Date: Mon, 1 Aug 2016 14:45:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:Qk6bn6BG1ex4RjUx6ADNYzoZ2beoUtm/++V4Ml7DRUG64adOFQo ygjYuJbAg7YsqWA5nkfBMy3nmPNTfwoaUqJNhZGWoj2OQewWVqr8qYxWdInzQ5cc03ewYuW Q069+7LQ7UVV/XnNBbH47Jp5zy7LOhMsAh5V0+AhYedRFFtaycuX9ibG1Uvn2t4CxeA/kM5 Eh5SBSDC+FjuNa5q7NC2A== X-UI-Out-Filterresults: notjunk:1;V01:K0:otOou58ajN4=:6EQS7kmYA2WTc4HNATtg1l 8zfn4uDsxMhfwWq08hzGK6d2r6ebrMP0RRP/tfzEvF/mBuTxYqXilBGWs1z9974fgsMu1f905 ZM5k997qqjz5SFPoLcafXzI6+9oSpfD+GwsCxYHP2UaE4gWmzi1AN+YRRMTddONQH8/7eJ7EI /7KMOm4YjN3tLDDFpr0NABfmCyDxTxjwiI8lASzwDX+7Mt1JGd1PNJbF5wMANd12bF5L7yuX8 TV3on5JFJkoltwrYSGu+x5vebK3WLQYIGfuP5JX4kJjlCWjIL9N48hxPYjdeg7v6tYpkZTFA6 Ck0oym0qTFLuiKrlEs0L+VOpsnQBptX2WbFNWWSAXZoBIYyP63g7JxPc4TRc8QtvbeWqRURzc UVuc51laUDmLrPNgjJ7AmRws3JzVaS00P/1S3Z+j+9cz7k/0FXuuKF7PmEiuMQz/UpV/PeWOU GQejKONMdlYSm9BbGaXQqN1uQGnorZc+SqwBbVgTrzIhgwRGcaXv/7GK/V/WyDY36YZRaDXo2 PHY+wAZQ8ph42SvdBnAJvzwpXUZ0+aqPHKPaH9yzfT//n/ftIiaUEHoCC4Zp07/V3Mv8TiIAf PW+rb3FnO3DJjDfKL7SndvO3AtwSHLWBBDuCxr8mRv+WbzHd1Jjjo/cThHRDfssyHwhCfqBF3 AxD/SfDDltJYaiywQR/1ecd8uNbbJjOv4SPqCK39XtNQ3pKgLSkgznlNoTZD5Uu1PZ9/nT6y3 E2zWsz293brT9ZLtdFnxpKNxn6SaHAnk3eHC8BFnpnqa4kIcEwAY+xEP5eg3TbLEvTzqAYhbh 9n+oJ0D Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>>> @vz_combined >>>> depends on patch && !context && !org && !report@ >>>> type T; >>>> T* pointer; >>>> +statement S; >>>> expression express; >>>> @@ >>>> pointer = >>>> - vmalloc >>>> + vzalloc >>>> (...); >>>> if (!d) >>>> S >>>> -memset(d, 0, sizeof( >>>> ( >>>> -T >>>> | >>>> -*(express) >>>> ) >>>> -)); > > Actually, this is a mess. pointer, d, and express are all supposed to be > the same thing, as they were in the original rule. > > Furthermore, this shows a reason why the original rule was better. There is a trade-off between several unique SmPL rules and other combined variants which could eventually work with two SmPL disjunctions. Regards, Markus From mboxrd@z Thu Jan 1 00:00:00 1970 From: elfring@users.sourceforge.net (SF Markus Elfring) Date: Mon, 1 Aug 2016 14:45:22 +0200 Subject: [Cocci] [PATCH v3] Coccinelle: Script to replace allocate and memset with zalloc functions In-Reply-To: References: <20160801070233.GA19102@amitoj-Inspiron-3542> <0dbd2dd6-4c68-1f7c-1500-9e5d40047813@users.sourceforge.net> Message-ID: <0cdfaa73-d2ba-acc3-523f-559f14fadbc1@users.sourceforge.net> To: cocci@systeme.lip6.fr List-Id: cocci@systeme.lip6.fr >>>> @vz_combined >>>> depends on patch && !context && !org && !report@ >>>> type T; >>>> T* pointer; >>>> +statement S; >>>> expression express; >>>> @@ >>>> pointer = >>>> - vmalloc >>>> + vzalloc >>>> (...); >>>> if (!d) >>>> S >>>> -memset(d, 0, sizeof( >>>> ( >>>> -T >>>> | >>>> -*(express) >>>> ) >>>> -)); > > Actually, this is a mess. pointer, d, and express are all supposed to be > the same thing, as they were in the original rule. > > Furthermore, this shows a reason why the original rule was better. There is a trade-off between several unique SmPL rules and other combined variants which could eventually work with two SmPL disjunctions. Regards, Markus