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>] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 18 Jul 2018 19:25:48 +0530
From:   Manish Narani <manish.narani@...inx.com>
To:     <apw@...onical.com>, <joe@...ches.com>,
        <linux-kernel@...r.kernel.org>
CC:     <anirudh@...inx.com>, <sgoud@...inx.com>, <svemula@...inx.com>,
        Manish Narani <manish.narani@...inx.com>
Subject: [PATCH] checkpatch: Resolve improper warning for krealloc arg reuse

Correct the check for reuse of krealloc. It gives false warning when a
structure member variable name and krealloc argument name is same.

For Example:
{
	...
	abc.def_var = krealloc(def_var, sizeof(*def_var),
				    GFP_KERNEL);
	...
}

$ ./scripts/checkpatch.pl -f file.c

WARNING: Reusing the krealloc arg is almost always a bug
+	abc.def_var = krealloc(def_var, sizeof(*def_var),

This patch resolves the above false warning.

Signed-off-by: Manish Narani <manish.narani@...inx.com>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 447857f..db9b666 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6119,7 +6119,7 @@ sub process {
 
 # check for krealloc arg reuse
 		if ($^V && $^V ge 5.10.0 &&
-		    $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*krealloc\s*\(\s*\1\s*,/) {
+		    $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*krealloc\s*\(\s*\1\s*,/ && $line !~ m/[\.|\-\>].*\s*\=\s*.*/) {
 			WARN("KREALLOC_ARG_REUSE",
 			     "Reusing the krealloc arg is almost always a bug\n" . $herecurr);
 		}
-- 
2.1.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ