Patchwork powerpc: Fix integer constant warning

login
register
mail settings
Submitter Steve Best
Date June 7, 2010, 8:49 p.m.
Message ID <20100607203957.23695.97675.sendpatchset@squad5-lp1.lab.bos.redhat.com>
Download mbox | patch
Permalink /patch/54893/
State Superseded
Delegated to: Benjamin Herrenschmidt
Headers show

Comments

Steve Best - June 7, 2010, 8:49 p.m.
Fix ppc arch/powerpc/boot/addRamDisk.c:277: warning: integer constant
is too large for 'long' type

Signed-off-by: Steve Best <sfbest@us.ibm.com>
David Howells - June 8, 2010, 1:12 p.m.
Steve Best <sfbest@us.ibm.com> wrote:

> -#define KERNELBASE (0xc000000000000000)
> +#define KERNELBASE (0xc000000000000000ULL)

Is this the right fix?  The code producing the warning is subtracting
0xc000000000000000 from a 32-bit number:

	naca = ntohl(*((u_int32_t*) &inbuf[0x0C])) - KERNELBASE;

which seems distinctly odd.

David
Josh Boyer - June 8, 2010, 1:55 p.m.
On Tue, Jun 08, 2010 at 02:12:26PM +0100, David Howells wrote:
>Steve Best <sfbest@us.ibm.com> wrote:
>
>> -#define KERNELBASE (0xc000000000000000)
>> +#define KERNELBASE (0xc000000000000000ULL)
>
>Is this the right fix?  The code producing the warning is subtracting
>0xc000000000000000 from a 32-bit number:

It might not matter, since Paul sent a patch to remove this file entirely.

josh
David Howells - June 8, 2010, 2:23 p.m.
Josh Boyer <jwboyer@linux.vnet.ibm.com> wrote:

> It might not matter, since Paul sent a patch to remove this file entirely.

Yeah, I saw that after...

David
Steve Best - June 9, 2010, 11:50 a.m.
On Tue, 2010-06-08 at 14:12 +0100, David Howells wrote:
> Steve Best <sfbest@us.ibm.com> wrote:
> 
> > -#define KERNELBASE (0xc000000000000000)
> > +#define KERNELBASE (0xc000000000000000ULL)
> 
> Is this the right fix?  The code producing the warning is subtracting
> 0xc000000000000000 from a 32-bit number:

agree this fix needs more work, and can be dropped. Paul has another
patch that removes this file, since it is no longer used. I assume we'll
go with that patch.
> 
> 	naca = ntohl(*((u_int32_t*) &inbuf[0x0C])) - KERNELBASE;
> 
> which seems distinctly odd.
> 
> David

-Steve

Patch

diff -purN linux.2.6.orig/arch/powerpc/boot/addRamDisk.c linux.2.6/arch/powerpc/boot/addRamDisk.c
--- linux.2.6.orig/arch/powerpc/boot/addRamDisk.c	2010-06-07 15:20:41.763844095 -0400
+++ linux.2.6/arch/powerpc/boot/addRamDisk.c	2010-06-07 15:27:15.165100339 -0400
@@ -9,7 +9,7 @@ 
 
 #define ElfHeaderSize  (64 * 1024)
 #define ElfPages  (ElfHeaderSize / 4096)
-#define KERNELBASE (0xc000000000000000)
+#define KERNELBASE (0xc000000000000000ULL)
 #define _ALIGN_UP(addr,size)	(((addr)+((size)-1))&(~((size)-1)))
 
 struct addr_range {