[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211011180650.3603988-1-keescook@chromium.org>
Date: Mon, 11 Oct 2021 11:06:50 -0700
From: Kees Cook <keescook@...omium.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Kees Cook <keescook@...omium.org>,
Matthew Wilcox <willy@...radead.org>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Joe Perches <joe@...ches.com>,
Jonathan Corbet <corbet@....net>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: [PATCH] scripts: kernel-doc: Ignore __alloc_size() attribute
Fixes "Compiler Attributes: add __alloc_size() for better bounds checking"
so that the __alloc_size() macro is ignored for function prototypes when
generating kerndoc. Avoids warnings like:
./include/linux/slab.h:662: warning: Function parameter or member '1' not described in '__alloc_size'
./include/linux/slab.h:662: warning: Function parameter or member '2' not described in '__alloc_size'
./include/linux/slab.h:662: warning: expecting prototype for kcalloc(). Prototype was for __alloc_size() instead
Suggested-by: Matthew Wilcox <willy@...radead.org>
Reported-by: Stephen Rothwell <sfr@...b.auug.org.au>
Signed-off-by: Kees Cook <keescook@...omium.org>
---
scripts/kernel-doc | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index cfcb60737957..c123bac28f7a 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1789,6 +1789,7 @@ sub dump_function($$) {
$prototype =~ s/__weak +//;
$prototype =~ s/__sched +//;
$prototype =~ s/__printf\s*\(\s*\d*\s*,\s*\d*\s*\) +//;
+ $prototype =~ s/__alloc_size\s*\(\s*\d+\s*(?:,\s*\d+\s*)?\) +//;
my $define = $prototype =~ s/^#\s*define\s+//; #ak added
$prototype =~ s/__attribute_const__ +//;
$prototype =~ s/__attribute__\s*\(\(
--
2.30.2
Powered by blists - more mailing lists