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] [thread-next>] [day] [month] [year] [list]
Message-ID: <1282167133.6724.165.camel@Joe-Laptop>
Date:	Wed, 18 Aug 2010 14:32:13 -0700
From:	Joe Perches <joe@...ches.com>
To:	Dave Jones <davej@...hat.com>
Cc:	apw@...onical.com, Linux Kernel <linux-kernel@...r.kernel.org>
Subject: Re: add memset checks to checkpatch.pl

On Wed, 2010-08-18 at 16:40 -0400, Dave Jones wrote:
> Occasionally someone goofs the argument order to memset.
> This patch makes checkpatch catch those.
> 
> I made memset with size of 0 an error, because it's never correct,
> whereas memset with a size of 1 isn't technically an incorrect
> thing to do so I left it as a warning. It may still be better to replace
> it with a single variable assignment in the false positive cases.

Maybe something like allows more flexible checking?

	if ($line =~ /\bmemset\s*\(\s*($Lval)\s*,\s*($Lval)\s*,\s*($Lval)\s*\)/) {
		my $memset_addr = $1;
		my $memset_val = $2;
		my $memset_size = $3;
		if ($memset_size =~ /(0x|)0$/i) {
			ERROR("memset uses second argument as constant byte value, not third.\n" . $herecurr);
		elsif ($memset_size =~ /(0x|)1/i) {
			WARN("single byte memset is suspicious. Swapped 2nd/3rd argument?\n" . $herecurr);
		}
	}


--
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