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, UNPARSEABLE_RELAY,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 8EF3BC433F5 for ; Sat, 11 Sep 2021 05:29:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E3702611C3 for ; Sat, 11 Sep 2021 05:29:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E3702611C3 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 1D57C900002; Sat, 11 Sep 2021 01:29:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 184506B0072; Sat, 11 Sep 2021 01:29:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0743E900002; Sat, 11 Sep 2021 01:29:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0253.hostedemail.com [216.40.44.253]) by kanga.kvack.org (Postfix) with ESMTP id ECA926B0071 for ; Sat, 11 Sep 2021 01:29:29 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 98C4C8249980 for ; Sat, 11 Sep 2021 05:29:29 +0000 (UTC) X-FDA: 78574164858.07.705F98E Received: from smtprelay.hostedemail.com (smtprelay0146.hostedemail.com [216.40.44.146]) by imf01.hostedemail.com (Postfix) with ESMTP id 3C35B505468B for ; Sat, 11 Sep 2021 05:29:29 +0000 (UTC) Received: from omf19.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay02.hostedemail.com (Postfix) with ESMTP id EB7B829DF1; Sat, 11 Sep 2021 05:29:28 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf19.hostedemail.com (Postfix) with ESMTPA id D2EB520D758; Sat, 11 Sep 2021 05:29:24 +0000 (UTC) Message-ID: <4028a9be304ae79d55d2ad099651c640f583df5d.camel@perches.com> Subject: Re: [patch 9/9] mm/vmalloc: add __alloc_size attributes for better bounds checking From: Joe Perches To: Linus Torvalds , Andrew Morton Cc: apw@canonical.com, Christoph Lameter , Daniel Micay , Dennis Zhou , dwaipayanray1@gmail.com, Joonsoo Kim , Kees Cook , Linux-MM , Lukas Bulwahn , mm-commits@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Miguel Ojeda , Pekka Enberg , David Rientjes , Tejun Heo , Vlastimil Babka Date: Fri, 10 Sep 2021 22:29:23 -0700 In-Reply-To: References: <20210909200948.090d4e213ca34b5ad1325a7e@linux-foundation.org> <20210910031046.G76dQvPhV%akpm@linux-foundation.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+9w6GlThcpvVJijJed+sZKczcsjABR48o= X-HE-Tag: 1631338164-2999 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 3C35B505468B Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=none; spf=none (imf01.hostedemail.com: domain of joe@perches.com has no SPF policy when checking 216.40.44.146) smtp.mailfrom=joe@perches.com X-Stat-Signature: i9z4abgqsmfn4cd1uksibzswaw7bp81a X-HE-Tag: 1631338169-359781 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 Fri, 2021-09-10 at 10:23 -0700, Linus Torvalds wrote: > On Thu, Sep 9, 2021 at 8:10 PM Andrew Morton wrote: > >=20 > > +__alloc_size(1) > > =A0extern void *vmalloc(unsigned long size); [] > So wouldn't this all have looked much more natural as >=20 > =A0=A0=A0=A0=A0void *vmalloc(unsigned long size) __malloc(1); >=20 > instead? Hmm? I think not as the __malloc attribute and in fact all the other function attributes are effectively uninteresting when it comes to grepping for function declarations. Putting the attribute lists after the function arguments in many cases would just be visual noise. My preference would be for declarations to be mostly like: [optional attribute list[ function(arguments); Frequently there are multiline function declarations with many arguments similar to either of [optional attribute list] function(type arg1, type arg2, etc...); or [optional attribute list] function(type arg1, type arg2, etc...); which always makes grep rather difficult. And given the expansion is naming lengths there are more and more of these multiline argument lists. It doesn't matter if the line length is increased above 80 columns or not. 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, UNPARSEABLE_RELAY,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 4F6B3C433F5 for ; Sat, 11 Sep 2021 05:36:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 16DB1611C3 for ; Sat, 11 Sep 2021 05:36:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231474AbhIKFhZ (ORCPT ); Sat, 11 Sep 2021 01:37:25 -0400 Received: from smtprelay0116.hostedemail.com ([216.40.44.116]:54288 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230392AbhIKFhZ (ORCPT ); Sat, 11 Sep 2021 01:37:25 -0400 X-Greylist: delayed 403 seconds by postgrey-1.27 at vger.kernel.org; Sat, 11 Sep 2021 01:37:25 EDT Received: from smtprelay.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by smtpgrave04.hostedemail.com (Postfix) with ESMTP id 880D3180E36C5 for ; Sat, 11 Sep 2021 05:29:30 +0000 (UTC) Received: from omf19.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay02.hostedemail.com (Postfix) with ESMTP id EB7B829DF1; Sat, 11 Sep 2021 05:29:28 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf19.hostedemail.com (Postfix) with ESMTPA id D2EB520D758; Sat, 11 Sep 2021 05:29:24 +0000 (UTC) Message-ID: <4028a9be304ae79d55d2ad099651c640f583df5d.camel@perches.com> Subject: Re: [patch 9/9] mm/vmalloc: add __alloc_size attributes for better bounds checking From: Joe Perches To: Linus Torvalds , Andrew Morton Cc: apw@canonical.com, Christoph Lameter , Daniel Micay , Dennis Zhou , dwaipayanray1@gmail.com, Joonsoo Kim , Kees Cook , Linux-MM , Lukas Bulwahn , mm-commits@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Miguel Ojeda , Pekka Enberg , David Rientjes , Tejun Heo , Vlastimil Babka Date: Fri, 10 Sep 2021 22:29:23 -0700 In-Reply-To: References: <20210909200948.090d4e213ca34b5ad1325a7e@linux-foundation.org> <20210910031046.G76dQvPhV%akpm@linux-foundation.org> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.0-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspamout01 X-Rspamd-Queue-Id: D2EB520D758 X-Stat-Signature: i91pz8j5jei8bzz71za3ieogfgs7zec9 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+9w6GlThcpvVJijJed+sZKczcsjABR48o= X-HE-Tag: 1631338164-2999 Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org On Fri, 2021-09-10 at 10:23 -0700, Linus Torvalds wrote: > On Thu, Sep 9, 2021 at 8:10 PM Andrew Morton wrote: > > > > +__alloc_size(1) > >  extern void *vmalloc(unsigned long size); [] > So wouldn't this all have looked much more natural as > >      void *vmalloc(unsigned long size) __malloc(1); > > instead? Hmm? I think not as the __malloc attribute and in fact all the other function attributes are effectively uninteresting when it comes to grepping for function declarations. Putting the attribute lists after the function arguments in many cases would just be visual noise. My preference would be for declarations to be mostly like: [optional attribute list[ function(arguments); Frequently there are multiline function declarations with many arguments similar to either of [optional attribute list] function(type arg1, type arg2, etc...); or [optional attribute list] function(type arg1, type arg2, etc...); which always makes grep rather difficult. And given the expansion is naming lengths there are more and more of these multiline argument lists. It doesn't matter if the line length is increased above 80 columns or not.