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=-8.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 CFDA8C4338F for ; Thu, 19 Aug 2021 02:19:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 49032610FA for ; Thu, 19 Aug 2021 02:19:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 49032610FA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 9C8FB6B006C; Wed, 18 Aug 2021 22:19:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 978D06B0071; Wed, 18 Aug 2021 22:19:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 868058D0001; Wed, 18 Aug 2021 22:19:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0213.hostedemail.com [216.40.44.213]) by kanga.kvack.org (Postfix) with ESMTP id 6ADC16B006C for ; Wed, 18 Aug 2021 22:19:16 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id E09B51813E4CC for ; Thu, 19 Aug 2021 02:19:15 +0000 (UTC) X-FDA: 78490223070.10.45A1889 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf08.hostedemail.com (Postfix) with ESMTP id A4652300A880 for ; Thu, 19 Aug 2021 02:19:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=6qFa63LSLe36g4wM0Z8z+Amgw0mnG5ofseKFv1HZmaM=; b=jkSVueB+uX0AcffMksm+YIvw3n SSLMObXwjcA4anhkE1Onilfxzd/yrStGGSPvaiC/48QLpoQpG97cRAWdv6EsdYDV3gi53abGV6c+M JUZRJ6sR3kKmGE0vAa+ELmF80mwEEDSKRY1OAjU4jB/UUPgv+lO+2YaZr0inx8tdX/z66LA2gxfgz Pz8g3y4GD2b+ASrT6P9ZcRgupZo6iBZQjzX/ylsSvr37QmVsG+yFmIx8MtSoKeJvZGT+HHUD374LP seEvSKvu3AKdsuTWkl0TcDFonl+lThil2DF69HAMJGStztY+VTQrzySLspfZz+3A05G8PgJK/loFS Uy0MkOnQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mGXbZ-004VHM-Ln; Thu, 19 Aug 2021 02:16:54 +0000 Date: Thu, 19 Aug 2021 03:16:29 +0100 From: Matthew Wilcox To: Joe Perches Cc: Jonathan Corbet , linux-doc , Kees Cook , linux-kernel@vger.kernel.org, Daniel Micay , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , linux-mm@kvack.org, Miguel Ojeda , Nathan Chancellor , Nick Desaulniers , Dennis Zhou , Tejun Heo , Masahiro Yamada , Michal Marek , clang-built-linux@googlegroups.com, linux-kbuild@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH 2/5] slab: Add __alloc_size attributes for better bounds checking Message-ID: References: <20210818050841.2226600-1-keescook@chromium.org> <20210818050841.2226600-3-keescook@chromium.org> <3a0c55a3fabc57ce9771c93499ef19327f3b8621.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <3a0c55a3fabc57ce9771c93499ef19327f3b8621.camel@perches.com> Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=jkSVueB+; dmarc=none; spf=none (imf08.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Stat-Signature: 7fehsya5cyan3pumtcsqrn1zs6ws63m8 X-Rspamd-Queue-Id: A4652300A880 X-Rspamd-Server: rspam01 X-HE-Tag: 1629339555-676778 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 Wed, Aug 18, 2021 at 06:10:57PM -0700, Joe Perches wrote: > On Thu, 2021-08-19 at 01:27 +0100, Matthew Wilcox wrote: > > On Tue, Aug 17, 2021 at 10:31:32PM -0700, Joe Perches wrote: > > > Lastly __alloc_size should probably be added to checkpatch > > >=20 > > > Maybe: > > > --- > > > =A0scripts/checkpatch.pl | 3 ++- > > > =A01 file changed, 2 insertions(+), 1 deletion(-) > > >=20 > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > [] > > > @@ -489,7 +489,8 @@ our $Attribute =3D qr{ > > > =A0 ____cacheline_aligned| > > > =A0 ____cacheline_aligned_in_smp| > > > =A0 ____cacheline_internodealigned_in_smp| > > > - __weak > > > + __weak| > > > + __alloc_size\s*\(\s*\d+\s*(?:,\s*d+\s*){0,5}\) > >=20 > > Should probably be added to kernel-doc as well. Any other awful rege= xes > > that need to be changed to understand it? And can we commonise the > > regexes that do exist into a perl helper library? >=20 > probably, but there would need to be some library work done and > changes made to both utilities so they could use the same $helpers. >=20 > And there are several nominally incomplete regexes already in > kernel-doc and I'm not at all familiar with kernel-doc. Yes, kernel-doc is an awful example of perl gone wild.