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>] [day] [month] [year] [list]
Message-ID: <20130608021509.GA13207@localhost>
Date:	Sat, 8 Jun 2013 10:15:09 +0800
From:	Fengguang Wu <fengguang.wu@...el.com>
To:	Tejun Heo <tj@...nel.org>
Cc:	Andrew Morton <akpm@...ux-foundation.org>, kbuild-all@...org,
	Christopher Li <sparse@...isli.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: kernel/workqueue.c:4435:61: sparse: expression using sizeof bool

// CC sparse people.

On Fri, Jun 07, 2013 at 07:05:49PM -0700, Tejun Heo wrote:
> Hello, Andrew.
> 
> On Fri, Jun 07, 2013 at 06:46:14PM -0700, Andrew Morton wrote:
> > I believe sizeof(bool) can vary between compilers (on gcc it's 1) but
> > that doesn't matter here.
> 
> Looking at the warning, I originally suspected that maybe the standard
> was crazy enough to allow mixed usages of different sizes for bool as
> the compiler sees fit.  Just scanned the spec, nothing that insane.
> It's a proper integeral type, so I'm now more puzzled why sparse is
> warning about sizeof(bool).
> 
> > sizeof(enum) can vary between compilers as well.  In fact I've seen a
> > compiler which used 2 if the enumerated values were 0..65535, and 4
> > otherwise.  So warning about sizeof(enum) would be a bit more useful
> > than about sizeof(bool).
> 
> Oh yeah, gcc does that too.  If the enum definition contains a number
> larger than 32bit, it'll grow it to 64bit.
> 
>  #include <stdio.h>
> 
>  enum { ENUM_A = 1LU };
>  enum { ENUM_B = 1LU << 31 };
>  enum { ENUM_C = 1LU << 32 };
> 
>  int main(void)
>  {
> 	 printf("%zu %zu %zu\n", sizeof(ENUM_A), sizeof(ENUM_B), sizeof(ENUM_C));
> 	 return 0;
>  }
> 
>  $ ./a.out
>  4 4 8
> 
> Whether sparse should trigger a warning on it, I don't know.
> 
> Thanks.
> 
> -- 
> tejun
--
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