From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA86AC433DB for ; Sat, 20 Feb 2021 15:15:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B92F164ECA for ; Sat, 20 Feb 2021 15:15:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229806AbhBTPPg (ORCPT ); Sat, 20 Feb 2021 10:15:36 -0500 Received: from smtprelay0222.hostedemail.com ([216.40.44.222]:50716 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229734AbhBTPPe (ORCPT ); Sat, 20 Feb 2021 10:15:34 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id A2B45837F253; Sat, 20 Feb 2021 15:14:49 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: wall13_5e05dae27667 X-Filterd-Recvd-Size: 2222 Received: from [192.168.1.159] (unknown [47.151.137.21]) (Authenticated sender: joe@perches.com) by omf02.hostedemail.com (Postfix) with ESMTPA; Sat, 20 Feb 2021 15:14:48 +0000 (UTC) Message-ID: Subject: Re: [PATCH v5 0/2] checkpatch: add verbose mode From: Joe Perches To: Dwaipayan Ray Cc: lukas.bulwahn@gmail.com, linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel@vger.kernel.org Date: Sat, 20 Feb 2021 07:14:46 -0800 In-Reply-To: <20210220120220.32585-1-dwaipayanray1@gmail.com> References: <20210220120220.32585-1-dwaipayanray1@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2021-02-20 at 17:32 +0530, Dwaipayan Ray wrote: > Add a new verbose mode to checkpatch. The verbose test > descriptions are read from the checkpatch documentation > file at `Documentation/dev-tools/checkpatch.rst`. > > The verbose mode is optional and can be enabled by the > flag -v or --verbose. > > The documentation file is only parsed by checkpatch.pl > if the verbose mode is enabled. The verbose mode can > not be used together with the --terse option. > > Changes in v5: > - Change the reference format to use absolute links. > - Print verbose descriptions only for the first time >   a message type is encountered. OK, I think a nice addition would be to add --verbose text to the --list-types option when used together. $ ./scripts/checkpatch.pl --list-types --verbose 1 ALLOC_ARRAY_ARGS The first argument for kcalloc or kmalloc_array should be the number of elements. sizeof() as the first argument is generally wrong. See: https://www.kernel.org/doc/html/latest/core-api/memory-allocation.html 2 ALLOC_SIZEOF_STRUCT The allocation style is bad. In general for family of allocation functions using sizeof() to get memory size, constructs like:: p = alloc(sizeof(struct foo), ...) should be:: p = alloc(sizeof(*p), ...) See: https://www.kernel.org/doc/html/latest/process/coding-style.html#allocating-memory etc...