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:	Sun, 04 Oct 2009 09:25:40 +0900
From:	Tejun Heo <tj@...nel.org>
To:	Randy Dunlap <randy.dunlap@...cle.com>
CC:	Stephen Rothwell <sfr@...b.auug.org.au>,
	linux-next@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: linux-next: Tree for October 2: percpu compile warnings (i386)

Hello,

Randy Dunlap wrote:
> mm/percpu.c:1873: warning: comparison of distinct pointer types lacks a cast
> mm/percpu.c:1879: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'size_t'
> 
> The second one is easily fixed (s/%lx/%zu/), but is that the correct fix?

I think so.  Will fix it up.

> The first one is a max(size_t, unsigned long).
> The C99 spec says that the max value of a size_t is:
> 	limit of size_t
> 	SIZE_MAX 65535

The same section also says

  limits of ptrdiff_t
  PTRDIFF_MIN         -65535
  PTRDIFF_MAX         +65535

and ptrdiff_t is defined as

	 ptrdiff_t
  which is the signed integer type of the result of subtracting two
  pointers;

Also, later in that section.

  The types used for size_t and ptrdiff_t should not have an integer
  conversion rank greater than that of signed long int unless the
  implementation supports objects large enough to make this necessary.

So, it looks like the limits there are examples from 16bit systems
although it's not stated anywhere.  Strange choice...

Anyways, at least in kernel, it's assumed to be large enough to carry
any supported memory size and in that sense it should be as large as
ptrdiff_t or intptr_t.  Otherwise, we're already deeply screwed (no
allocation larger than 64k or no vmalloc area larger than 64k!).

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