lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Thu, 26 Aug 2021 11:19:21 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Andy Whitcroft <apw@...onical.com>, Joe Perches <joe@...ches.com>
Cc:     Dwaipayan Ray <dwaipayanray1@...il.com>,
        Lukas Bulwahn <lukas.bulwahn@...il.com>,
        linux-kernel@...r.kernel.org, mhiramat@...nel.org
Subject: [PATCH] checkpatch: Do not warn __initconst for const char *.

checkpatch.pl warns if an '__initdata' variable has 'const'
attribute to use __initconst, but it doesn't check that attribute
affects the type of a pointer or the variable. Thus it reports an
false error if 'const char *' variable is '__initdata'. e.g.

ERROR: Use of const init definition must use __initconst
#32: FILE: lib/bootconfig.c:32:
+static const char *xbc_err_msg __initdata;

To fix this issue, this ensures that the 'const' does not
follows any type string and a pointer ('*') too.

Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
---
 scripts/checkpatch.pl |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 461d4221e4a4..c04213a7b633 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6330,7 +6330,7 @@ sub process {
 		}
 
 # check for $InitAttributeData (ie: __initdata) with const
-		if ($line =~ /\bconst\b/ && $line =~ /($InitAttributeData)/) {
+		if ($line =~ /\bconst\b/ && $line !~ /\bconst\b[^\*\(]+\*/ && $line =~ /($InitAttributeData)/) {
 			my $attr = $1;
 			$attr =~ /($InitAttributePrefix)(.*)/;
 			my $attr_prefix = $1;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ