* [PATCH] The compiler's revenge
@ 2004-11-04 10:35 Thomas Koeller
0 siblings, 0 replies; only message in thread
From: Thomas Koeller @ 2004-11-04 10:35 UTC (permalink / raw)
To: linux-mips
... for lying to it is to produce code that does unexpected things.
In include/asm-mips/io.h, mips_io_port_base is declared to be const,
but can actually be modified using set_io_port_base(). The compiler
believes the const declaration and uses the uninitialized value if
an in(b|w|l) or out(b|w|l) is used right after set_io_port_base().
Signed-off-by: Thomas Koeller <thomas.koeller@baslerweb.com>
--- linux-mips-cvs/include/asm-mips/io.h 2004-10-25 11:16:42.000000000 +0200
+++ linux-mips-basler/include/asm-mips/io.h 2004-11-04 10:40:57.796646368 +0100
@@ -67,10 +67,9 @@
* instruction, so the lower 16 bits must be zero. Should be true on
* on any sane architecture; generic code does not use this assumption.
*/
-extern const unsigned long mips_io_port_base;
+extern unsigned long mips_io_port_base;
-#define set_io_port_base(base) \
- do { * (unsigned long *) &mips_io_port_base = (base); } while (0)
+#define set_io_port_base(base) mips_io_port_base = (base)
/*
* Thanks to James van Artsdalen for a better timing-fix than
--- linux-mips-cvs/arch/mips/kernel/setup.c 2004-07-14 16:21:29.000000000 +0200
+++ linux-mips-basler/arch/mips/kernel/setup.c 2004-11-04 10:39:45.359658464 +0100
@@ -78,7 +78,7 @@
* mips_io_port_base is the begin of the address space to which x86 style
* I/O ports are mapped.
*/
-const unsigned long mips_io_port_base = -1;
+unsigned long mips_io_port_base = -1;
EXPORT_SYMBOL(mips_io_port_base);
/*
--
--------------------------------------------------
Thomas Koeller, Software Development
Basler Vision Technologies
thomas dot koeller at baslerweb dot com
http://www.baslerweb.com
==============================
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-11-04 10:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-04 10:35 [PATCH] The compiler's revenge Thomas Koeller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox