Commit 37f7d708 authored by Linus Torvalds's avatar Linus Torvalds

Did you know that C integer constant promotions are different

depending on whether the constant is a hexadecimal one as
opposed to a decimal one? 

Let's make it all explicit. There are probably more lurking
around, these were found during development of my C checker tool.
parent 9e0206ab
......@@ -162,7 +162,7 @@ cmd_line_ptr: .long 0 # (Header version 0x0202 or later)
# can be located anywhere in
# low memory 0x10000 or higher.
ramdisk_max: .long __MAXMEM-1 # (Header version 0x0203 or later)
ramdisk_max: .long MAXMEM-1 # (Header version 0x0203 or later)
# The highest safe address for
# the contents of an initrd
......
......@@ -169,7 +169,7 @@ cmd_line_ptr: .long 0 # (Header version 0x0202 or later)
# can be located anywhere in
# low memory 0x10000 or higher.
ramdisk_max: .long __MAXMEM-1 # (Header version 0x0203 or later)
ramdisk_max: .long MAXMEM-1 # (Header version 0x0203 or later)
# The highest safe address for
# the contents of an initrd
......
......@@ -2019,7 +2019,7 @@ int __init ide_setup (char *s)
goto done;
}
#endif /* CONFIG_BLK_DEV_HT6560B */
#if CONFIG_BLK_DEV_QD65XX
#ifdef CONFIG_BLK_DEV_QD65XX
case -12: /* "qd65xx" */
{
extern void init_qd65xx (void);
......
......@@ -90,8 +90,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
* and CONFIG_HIGHMEM64G options in the kernel configuration.
*/
#define __PAGE_OFFSET (0xC0000000)
/*
* This much address space is reserved for vmalloc() and iomap()
* as well as fixmap mappings.
......@@ -116,10 +114,16 @@ static __inline__ int get_order(unsigned long size)
#endif /* __ASSEMBLY__ */
#ifdef __ASSEMBLY__
#define __PAGE_OFFSET (0xC0000000)
#else
#define __PAGE_OFFSET (0xC0000000UL)
#endif
#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
#define __MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE)
#define MAXMEM ((unsigned long)(-PAGE_OFFSET-VMALLOC_RESERVE))
#define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE)
#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
......
......@@ -69,7 +69,7 @@ __asm__ __volatile__(
"testb %%al,%%al\n\t"
"jne 1b"
: "=&S" (d0), "=&D" (d1), "=&a" (d2), "=&c" (d3)
: "0" (src), "1" (dest), "2" (0), "3" (0xffffffff):"memory");
: "0" (src), "1" (dest), "2" (0), "3" (0xffffffffu):"memory");
return dest;
}
......@@ -91,7 +91,7 @@ __asm__ __volatile__(
"2:\txorl %2,%2\n\t"
"stosb"
: "=&S" (d0), "=&D" (d1), "=&a" (d2), "=&c" (d3)
: "0" (src),"1" (dest),"2" (0),"3" (0xffffffff), "g" (count)
: "0" (src),"1" (dest),"2" (0),"3" (0xffffffffu), "g" (count)
: "memory");
return dest;
}
......@@ -186,7 +186,7 @@ __asm__ __volatile__(
"scasb\n\t"
"notl %0\n\t"
"decl %0"
:"=c" (__res), "=&D" (d0) :"1" (s),"a" (0), "0" (0xffffffff));
:"=c" (__res), "=&D" (d0) :"1" (s),"a" (0), "0" (0xffffffffu));
return __res;
}
......
......@@ -24,7 +24,7 @@
#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF)
#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFFUL)
#define USER_DS MAKE_MM_SEG(PAGE_OFFSET)
#define get_ds() (KERNEL_DS)
......
......@@ -47,23 +47,23 @@ extern __inline__ int generic_fls(int x)
if (!x)
return 0;
if (!(x & 0xffff0000)) {
if (!(x & 0xffff0000u)) {
x <<= 16;
r -= 16;
}
if (!(x & 0xff000000)) {
if (!(x & 0xff000000u)) {
x <<= 8;
r -= 8;
}
if (!(x & 0xf0000000)) {
if (!(x & 0xf0000000u)) {
x <<= 4;
r -= 4;
}
if (!(x & 0xc0000000)) {
if (!(x & 0xc0000000u)) {
x <<= 2;
r -= 2;
}
if (!(x & 0x80000000)) {
if (!(x & 0x80000000u)) {
x <<= 1;
r -= 1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment