This patch fixes an undefined behavior problem that may lead to the function 
result be treated in some cases
as signed integer instead of unsigned. This affected ms-dos extended partition 
parsing for partitions that start
after sector 2^31 (or 1TB): https://dev.openwrt.org/ticket/13420
The function is only used for archs that does not implement the le/be 
conversion in hardware.

Signed-off-by: Luiz Angelo Daros de Luca <luizl...@gmail.com>

Index: 
target/linux/generic/patches-3.3/141-fix_undefined_behavior_on_get_unaligned_le.patch
===================================================================
--- 
target/linux/generic/patches-3.3/141-fix_undefined_behavior_on_get_unaligned_le.patch
    (revision 0)
+++ 
target/linux/generic/patches-3.3/141-fix_undefined_behavior_on_get_unaligned_le.patch
    (working copy)
@@ -0,0 +1,17 @@
+--- linux-3.3.8/include/./linux/unaligned/le_byteshift.h.old    2013-04-28 
03:09:46.220538584 -0300
++++ linux-3.3.8/include/./linux/unaligned/le_byteshift.h    2013-04-28 
03:10:54.232538576 -0300
+@@ -5,12 +5,12 @@
+
+ static inline u16 __get_unaligned_le16(const u8 *p)
+ {
+-    return p[0] | p[1] << 8;
++    return p[0] | (u16)p[1] << 8;
+ }
+
+ static inline u32 __get_unaligned_le32(const u8 *p)
+ {
+-    return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;
++    return p[0] | (u32)p[1] << 8 | (u32)p[2] << 16 | (u32)p[3] << 24;
+ }
+
+ static inline u64 __get_unaligned_le64(const u8 *p)

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to