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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B9D9C433FE for ; Mon, 11 Oct 2021 18:23:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B292260E90 for ; Mon, 11 Oct 2021 18:23:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B292260E90 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 3681B6B0071; Mon, 11 Oct 2021 14:23:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 318756B0072; Mon, 11 Oct 2021 14:23:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 20792900002; Mon, 11 Oct 2021 14:23:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0100.hostedemail.com [216.40.44.100]) by kanga.kvack.org (Postfix) with ESMTP id 0EBE36B0071 for ; Mon, 11 Oct 2021 14:23:37 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id B25DF180388F6 for ; Mon, 11 Oct 2021 18:23:36 +0000 (UTC) X-FDA: 78684979632.16.4D39310 Received: from smtprelay.hostedemail.com (smtprelay0025.hostedemail.com [216.40.44.25]) by imf06.hostedemail.com (Postfix) with ESMTP id 504DA801C36A for ; Mon, 11 Oct 2021 18:23:36 +0000 (UTC) Received: from omf16.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay01.hostedemail.com (Postfix) with ESMTP id EE257100E7B59; Mon, 11 Oct 2021 18:23:35 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf16.hostedemail.com (Postfix) with ESMTPA id 97EB42550F1; Mon, 11 Oct 2021 18:23:34 +0000 (UTC) Message-ID: <2d6bf6a7413fafce51a7e1d80c959b57faeb4b75.camel@perches.com> Subject: Re: [PATCH] scripts: kernel-doc: Ignore __alloc_size() attribute From: Joe Perches To: Kees Cook , Andrew Morton Cc: Matthew Wilcox , Stephen Rothwell , Jonathan Corbet , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-hardening@vger.kernel.org Date: Mon, 11 Oct 2021 11:23:33 -0700 In-Reply-To: <20211011180650.3603988-1-keescook@chromium.org> References: <20211011180650.3603988-1-keescook@chromium.org> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.0-1 MIME-Version: 1.0 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1/XcxNNFly5dEc3mwylO5u/uBrBiKCxf2w= X-HE-Tag: 1633976614-606409 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 504DA801C36A X-Stat-Signature: xe1wipm6jca81xstsszpe7ikiksz1sh7 Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=none; spf=none (imf06.hostedemail.com: domain of joe@perches.com has no SPF policy when checking 216.40.44.25) smtp.mailfrom=joe@perches.com X-HE-Tag: 1633976616-528369 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, 2021-10-11 at 11:06 -0700, Kees Cook wrote: > Fixes "Compiler Attributes: add __alloc_size() for better bounds checki= ng" > so that the __alloc_size() macro is ignored for function prototypes whe= n > generating kerndoc. Avoids warnings like: >=20 > ./include/linux/slab.h:662: warning: Function parameter or member '1' n= ot described in '__alloc_size' > ./include/linux/slab.h:662: warning: Function parameter or member '2' n= ot described in '__alloc_size' > ./include/linux/slab.h:662: warning: expecting prototype for kcalloc().= Prototype was for __alloc_size() instead [] > diff --git a/scripts/kernel-doc b/scripts/kernel-doc [] > @@ -1789,6 +1789,7 @@ sub dump_function($$) { > =A0=A0=A0=A0=A0$prototype =3D~ s/__weak +//; > =A0=A0=A0=A0=A0$prototype =3D~ s/__sched +//; > =A0=A0=A0=A0=A0$prototype =3D~ s/__printf\s*\(\s*\d*\s*,\s*\d*\s*\) +//= ; > + $prototype =3D~ s/__alloc_size\s*\(\s*\d+\s*(?:,\s*\d+\s*)?\) +//; > =A0=A0=A0=A0=A0my $define =3D $prototype =3D~ s/^#\s*define\s+//; #ak a= dded > =A0=A0=A0=A0=A0$prototype =3D~ s/__attribute_const__ +//; > =A0=A0=A0=A0=A0$prototype =3D~ s/__attribute__\s*\(\( Perhaps all this would be more intelligible and a bit more future-proof using a regex that consumes all the various __ prefixed attributes. Maybe: my $balanced_parens =3D qr/(\((?:[^\(\)]++|(?-1))*\))/; $prototype =3D~ s/\b__\w+\s*(?:$balanced_parens)?\s*//g;