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-prev] [day] [month] [year] [list]
Date:	Fri, 30 Jan 2015 23:27:31 -0800
From:	Joe Perches <joe@...ches.com>
To:	Heba Aamer <heba93aamer@...il.com>
Cc:	apw@...onical.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] checkpatch: enhance check for seq_printf uses that
 could be seq_puts

On Sat, 2015-01-31 at 04:04 +0200, Heba Aamer wrote:
> This patch enhances the check for seq_printf uses that could
> be seq_puts.
> 
> It was considering the escape of % is \%, but it is %%.
> This led to skipping some valid cases related to that warning.  
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -4804,11 +4804,14 @@ sub process {
>  # check for seq_printf uses that could be seq_puts
>  		if ($sline =~ /\bseq_printf\s*\(.*"\s*\)\s*;\s*$/) {
>  			my $fmt = get_quoted_string($line, $rawline);
> -			if ($fmt ne "" && $fmt !~ /[^\\]\%/) {
> -				if (WARN("PREFER_SEQ_PUTS",
> -					 "Prefer seq_puts to seq_printf\n" . $herecurr) &&
> -				    $fix) {
> -					$fixed[$fixlinenr] =~ s/\bseq_printf\b/seq_puts/;
> +			if ($fmt ne "") {
> +				$fmt =~ s/%%//g;
> +				if ($fmt !~ /%/) {
> +					if (WARN("PREFER_SEQ_PUTS",
> +						 "Prefer seq_puts to seq_printf\n" . $herecurr) &&
> +					    $fix) {
> +						$fixed[$fixlinenr] =~ s/\bseq_printf\b/seq_puts/;
> +					}
>  				}
>  			}
>  		}

Probably be simpler to use:
---
 scripts/checkpatch.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 059c032..7f1804e 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4854,7 +4854,8 @@ sub process {
 # check for seq_printf uses that could be seq_puts
 		if ($sline =~ /\bseq_printf\s*\(.*"\s*\)\s*;\s*$/) {
 			my $fmt = get_quoted_string($line, $rawline);
-			if ($fmt ne "" && $fmt !~ /[^\\]\%/) {
+			$fmt =~ s/%%//g;
+			if ($fmt !~ /%/) {
 				if (WARN("PREFER_SEQ_PUTS",
 					 "Prefer seq_puts to seq_printf\n" . $herecurr) &&
 				    $fix) {


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ