Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751525AbdL2RXG (ORCPT ); Fri, 29 Dec 2017 12:23:06 -0500 Received: from conssluserg-04.nifty.com ([210.131.2.83]:59762 "EHLO conssluserg-04.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751152AbdL2RXE (ORCPT ); Fri, 29 Dec 2017 12:23:04 -0500 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com vBTHN1JX008276 X-Nifty-SrcIP: [209.85.213.51] X-Google-Smtp-Source: ACJfBotLQnIJoF7mP02/mcmiSnDu0j2l4QCb3h2sRuelNCz/oFdQDAPMciidhyldUDJl5cOgAxxNkKQxacQSsuPh1SA= MIME-Version: 1.0 In-Reply-To: <1514324410-14561-1-git-send-email-himanshujha199640@gmail.com> References: <1514324410-14561-1-git-send-email-himanshujha199640@gmail.com> From: Masahiro Yamada Date: Sat, 30 Dec 2017 02:22:19 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] Coccinelle: kzalloc-simple: Add all zero allocating functions To: Himanshu Jha Cc: Julia Lawall , Gilles Muller , Nicolas Palix , Michal Marek , cocci@systeme.lip6.fr, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1152 Lines: 43 2017-12-27 6:40 GMT+09:00 Himanshu Jha : > There are many instances where memory is allocated using regular > allocator > functions immediately followed by setting the allocated memory > to 0 value using memset. > > We already have zero memory allocator functions to set the memory to > 0 value instead of manually setting it using memset. > > Therefore, use zero memory allocating functions instead of regular > memory allocators followed by memset 0 to remove redundant memset and > make the code more cleaner and also reduce the code size. > > Signed-off-by: Himanshu Jha > --- > > v2: > -fix typo in copyright. > -move all the (T *) disjunction cases before (T) as (T) matches any cast > at all including (T *) ones which is not desirable. > ... > +@script:python depends on report@ > +p << r9.p; > +x << r9.x; > +@@ > + > +msg="WARNING: kvzalloc_node should be used for %s, instead of kvmalloc_node/memset" % (x) > +coccilib.report.print_report(p[0], msg) > + I removed the blank line at EOF, then applied to linux-kbuild/misc. Thanks! -- Best Regards Masahiro Yamada