Broken __get_unaligned from <asm-generic/unaligned.h>
__get_unaligned can't cope with const-qualified types:
drivers/char/vc_screen.c: In function 'vcs_write':drivers/char/vc_screen.c:422: error: assignment of read-only variable 'val' drivers/char/vc_screen.c:422: error: assignment of read-only variable 'val' drivers/char/vc_screen.c:422: error: assignment of read-only variable 'val' drivers/char/vc_screen.c:422: error: assignment of read-only variable 'val'
include/asm-generic/unaligned.h renamed from include/asm-generic/unaligned.h.~1~ +2 -2
@@ -78,7 +78,7 @@ static inline void __ustw(__u16 val, __u#define __get_unaligned (ptr, size) ({ \ const void *__gu_p = ptr; \ - __typeof__(*(ptr)) val; \ + unsigned long val; \ switch (size) { \ case 1: \ val = *(const __u8 *)__gu_p; \
@@ -95,7 +95,7 @@ static inline void __ustw(__u16 val, __udefault : \bad_unaligned_access_length (); \ }; \ - val; \ + (__typeof__ (*(ptr )))val; \ })#define __put_unaligned (val, ptr, size) \
Andreas.
Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Quoted 7 lines · Andreas Schwab
__get_unalignedcan't cope with const-qualified types:
drivers/char/vc_screen.c: In function 'vcs_write':drivers/char/vc_screen.c:422: error: assignment of read-only variable 'val'drivers/char/vc_screen.c:422: error: assignment of read-only variable 'val'drivers/char/vc_screen.c:422: error: assignment of read-only variable 'val'drivers/char/vc_screen.c:422: error: assignment of read-only variable 'val'
What if get_unaligned is used with a u64 / long long type (which it is)?
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of: 2.6 Serial core
Quoted 10 lines · Russell King
Quoted 7 lines · Andreas Schwab
__get_unalignedcan't cope with const-qualified types:
drivers/char/vc_screen.c: In function 'vcs_write':drivers/char/vc_screen.c:422: error: assignment of read-only variable 'val'drivers/char/vc_screen.c:422: error: assignment of read-only variable 'val'drivers/char/vc_screen.c:422: error: assignment of read-only variable 'val'drivers/char/vc_screen.c:422: error: assignment of read-only variable 'val'What if
get_unalignedis used with a u64 / long long type (which it is)?
Oops, I missed that, it needs a different approach.
Andreas.
Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."