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]
Message-ID: <1499694677.5468.9.camel@perches.com>
Date:   Mon, 10 Jul 2017 06:51:17 -0700
From:   Joe Perches <joe@...ches.com>
To:     Andrew Morton <akpm@...ux-foundation.org>,
        Andy Whitcroft <apw@...onical.com>
Cc:     me@...in.cc, devel@...verdev.osuosl.org,
        linux-kernel@...r.kernel.org, shiva@...ev.nl,
        AndyS <lkd1024@...l.ru>, gregkh@...uxfoundation.org
Subject: Re: [PATCH] Staging:ks7010:ks_wlan_net.c: unneeded type casting
 removed

A floating point constant cast to an int was giving
a false positive warning about unneeded cast to int.

e.g.:

	(fwrq->m >= (int)2.412e8) && (fwrq->m <= (int)2.487e8))

Fix it.

Though it's probably better to avoid float/double values
that are cast to int at all.

Signed-off-by: Joe Perches <joe@...ches.com>
---
 scripts/checkpatch.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 2287a0bca863..cbd99c22e2f6 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5673,7 +5673,8 @@ sub process {
 		}
 
 # check for cast of C90 native int or longer types constants
-		if ($line =~ /(\(\s*$C90_int_types\s*\)\s*)($Constant)\b/) {
+		if ($line =~ /(\(\s*$C90_int_types\s*\)\s*)($Constant)\b/ &&
+		    $2 !~ /^$Float$/) {
 			my $cast = $1;
 			my $const = $2;
 			if (WARN("TYPECAST_INT_CONSTANT",

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ