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]
Date:	Wed, 31 Oct 2012 15:49:08 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Pavel Machek <pavel@....cz>
Cc:	Joe Perches <joe@...ches.com>, Andy Whitcroft <apw@...onical.com>,
	Adil Mujeeb <mujeeb.adil@...il.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] checkpatch: Emit a warning when decimal values are
 used

On Wed, 31 Oct 2012 11:37:03 +0100
Pavel Machek <pavel@....cz> wrote:

> Hi!
> 
> > Linux kernel doesn't like decimals, say so.
> 
> ?!
> 
> Linux surely supports decimal constants, like "100". Did you mean
> "octal"?
> 
> If you wanted to add warning for something... I never want to see
> 
> #define CRAPPY_EMBEDDED_REGISTER ((0x1) << (0))
> 
> again....

Joe means floating point.  I suggest that the patchset be reworked,
using s/decimal/float/g.


The kernel does have floating point constants, in various graphics
drivers, iirc.  They are used in places where the floatiness gets
handled at complation time.  Along the lines of:

	int foo = 1.1 * 2.2;

And I suppose that's an OK thing to do.  We could instead do

	int foo = 2;	/* 1.1 * 2.2 */

but that's taking away a programmer convenience for no good reason. 
It would be highly inconvenient if the "1.1" was in fact a #define in
some other file, or a Kconfig string.



That being said, I guess it's a worthwhile thing for checkpatch to warn
about.  Hopefully the programmer will say "well thanks, but I meant to
do that".

A much better solution would be to arrange for the kernel to fail to
compile (or to fail to link) if floats are used.  That way, people
could continue to use floats within their compile-time scalar
expressions without getting harrassed by checkpatch.  But I don't know
how to arrange this.

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