Re: New x86 warning

From: Ingo Molnar
Date: Wed Apr 22 2009 - 03:03:36 EST



* Jeff Garzik <jeff@xxxxxxxxxx> wrote:

> On x86-32, this warning now appears for me in 2.6.30-rc3, and did
> not appear in 2.6.29.
>
> drivers/acpi/acpica/tbfadt.c: In function 'acpi_tb_create_local_fadt':
> /spare/repo/linux-2.6/arch/x86/include/asm/string_32.h:75: warning:
> array subscript is above array bounds

Last i checked it was a GCC bounds check bogosity. All attempts to
work it around or annotate it sanely (without changing the assembly
code) failed. (new ideas welcome)

The closest i came was the hacklet below to the assembly code. [with
an intentionally corrupted patch header to make it harder to apply
accidentally.]

The hacklet writes the fifth byte by writing two bytes from byte
position 3.

> lspci, dmesg and .config attached.
>
> Jeff
>
> P.S. It is unclear in MAINTAINERS whether x86@xxxxxxxxxx should
> be CC'd in addition to the other addresses listed, or as a
> replacement for individual emails.

at your option. Cc:-ing maintainers directly can get faster
treatment occasionally. Using the alias is shorter.

Ingo

NOT-Signed-off-by-me:

+++ linux/arch/x86/include/asm/string_32.h
@@ -72,7 +72,7 @@ static __always_inline void *__constant_
return to;
case 5:
*(int *)to = *(int *)from;
- *((char *)to + 4) = *((char *)from + 4);
+ *((short *)(char *)(to + 3)) = *((short *)(char *)(from + 3));
return to;
case 6:
*(int *)to = *(int *)from;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/