diff options
author | David Miller <davem@davemloft.net> | 2008-07-25 02:38:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-25 12:28:09 -0400 |
commit | 3d6f4a20cc287a8980c6186624834cf10a70752b (patch) | |
tree | 851e6f595fe7a03ca626287be24961517cf47709 | |
parent | 43de804df8d6002059bf4af4522fa9273a19b8aa (diff) |
endian: Always evaluate arguments.
Changeset 7fa897b91a3ea0f16c2873b869d7a0eef05acff4 ("ide: trivial sparse
annotations") created an IDE bootup regression on big-endian systems.
In drivers/ide/ide-iops.c, function ide_fixstring() we now have the
loop:
for (p = end ; p != s;)
be16_to_cpus((u16 *)(p -= 2));
which will never terminate on big-endian because in such
a configuration be16_to_cpus() evaluates to "do { } while (0)"
Therefore, always evaluate the arguments to nop endian transformation
operations.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/byteorder/big_endian.h | 12 | ||||
-rw-r--r-- | include/linux/byteorder/little_endian.h | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/include/linux/byteorder/big_endian.h b/include/linux/byteorder/big_endian.h index 961ed4b48d8e..44f95b92393b 100644 --- a/include/linux/byteorder/big_endian.h +++ b/include/linux/byteorder/big_endian.h | |||
@@ -94,12 +94,12 @@ static inline __u16 __be16_to_cpup(const __be16 *p) | |||
94 | #define __le32_to_cpus(x) __swab32s((x)) | 94 | #define __le32_to_cpus(x) __swab32s((x)) |
95 | #define __cpu_to_le16s(x) __swab16s((x)) | 95 | #define __cpu_to_le16s(x) __swab16s((x)) |
96 | #define __le16_to_cpus(x) __swab16s((x)) | 96 | #define __le16_to_cpus(x) __swab16s((x)) |
97 | #define __cpu_to_be64s(x) do {} while (0) | 97 | #define __cpu_to_be64s(x) do { (void)(x); } while (0) |
98 | #define __be64_to_cpus(x) do {} while (0) | 98 | #define __be64_to_cpus(x) do { (void)(x); } while (0) |
99 | #define __cpu_to_be32s(x) do {} while (0) | 99 | #define __cpu_to_be32s(x) do { (void)(x); } while (0) |
100 | #define __be32_to_cpus(x) do {} while (0) | 100 | #define __be32_to_cpus(x) do { (void)(x); } while (0) |
101 | #define __cpu_to_be16s(x) do {} while (0) | 101 | #define __cpu_to_be16s(x) do { (void)(x); } while (0) |
102 | #define __be16_to_cpus(x) do {} while (0) | 102 | #define __be16_to_cpus(x) do { (void)(x); } while (0) |
103 | 103 | ||
104 | #ifdef __KERNEL__ | 104 | #ifdef __KERNEL__ |
105 | #include <linux/byteorder/generic.h> | 105 | #include <linux/byteorder/generic.h> |
diff --git a/include/linux/byteorder/little_endian.h b/include/linux/byteorder/little_endian.h index 05dc7c35b3b2..4cc170a31762 100644 --- a/include/linux/byteorder/little_endian.h +++ b/include/linux/byteorder/little_endian.h | |||
@@ -88,12 +88,12 @@ static inline __u16 __be16_to_cpup(const __be16 *p) | |||
88 | { | 88 | { |
89 | return __swab16p((__u16 *)p); | 89 | return __swab16p((__u16 *)p); |
90 | } | 90 | } |
91 | #define __cpu_to_le64s(x) do {} while (0) | 91 | #define __cpu_to_le64s(x) do { (void)(x); } while (0) |
92 | #define __le64_to_cpus(x) do {} while (0) | 92 | #define __le64_to_cpus(x) do { (void)(x); } while (0) |
93 | #define __cpu_to_le32s(x) do {} while (0) | 93 | #define __cpu_to_le32s(x) do { (void)(x); } while (0) |
94 | #define __le32_to_cpus(x) do {} while (0) | 94 | #define __le32_to_cpus(x) do { (void)(x); } while (0) |
95 | #define __cpu_to_le16s(x) do {} while (0) | 95 | #define __cpu_to_le16s(x) do { (void)(x); } while (0) |
96 | #define __le16_to_cpus(x) do {} while (0) | 96 | #define __le16_to_cpus(x) do { (void)(x); } while (0) |
97 | #define __cpu_to_be64s(x) __swab64s((x)) | 97 | #define __cpu_to_be64s(x) __swab64s((x)) |
98 | #define __be64_to_cpus(x) __swab64s((x)) | 98 | #define __be64_to_cpus(x) __swab64s((x)) |
99 | #define __cpu_to_be32s(x) __swab32s((x)) | 99 | #define __cpu_to_be32s(x) __swab32s((x)) |