[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20091002094030.ffbde6ca.randy.dunlap@oracle.com>
Date: Fri, 2 Oct 2009 09:40:30 -0700
From: Randy Dunlap <randy.dunlap@...cle.com>
To: Stephen Rothwell <sfr@...b.auug.org.au>, Tejun Heo <tj@...nel.org>
Cc: linux-next@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: linux-next: Tree for October 2: percpu compile warnings (i386)
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?
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
(from 7.8.13(2)), but max_distance (the size_t here) is being compared to
unsigned long base_offset, which isn't limited to 65535 AFAICT.
In fact, this test:
if (max_distance > (VMALLOC_END - VMALLOC_START) * 3 / 4) {
checks max_distance > 0x000017ff_ffffffff (on x86_64).
And it looks to me like there is some potential for some value truncation
in the max() operation, even if size_t is not limited to SIZE_MAX.
So maybe the size_t(s) should be changed to unsigned long and the
printk format doesn't need to be fixed... ?
---
~Randy
--
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