Commit 49d468f6 authored by Roland Vossen's avatar Roland Vossen Committed by Greg Kroah-Hartman

staging: brcm80211: bugfix for exception on Sparc platforms

Problem would pop up during driver load on a Sun Fire V120 and manifested
itself as an exception. This was caused by int* pointers provided to memcpy()
that were not aligned on an int boundary. The pointer type provided to
memcpy() is used by the compiler for optimization purposes. Fix was to cast
the int* pointers to void* pointers.

Bernhard R. Link and David S. Miller provided valuable feedback, thanks gents.
Reviewed-by: default avatarArend van Spriel <arend@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 183eeb98
...@@ -6111,9 +6111,12 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len, ...@@ -6111,9 +6111,12 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,
/* default argument is generic integer */ /* default argument is generic integer */
pval = arg ? (int *)arg : NULL; pval = arg ? (int *)arg : NULL;
/* This will prevent the misaligned access */ /*
* This will prevent misaligned access. The (void *) cast prevents a
* memcpy alignment issue on e.g. Sparc64 platforms.
*/
if (pval && (u32) len >= sizeof(val)) if (pval && (u32) len >= sizeof(val))
memcpy(&val, pval, sizeof(val)); memcpy((void *)&val, (void *)pval, sizeof(val));
else else
val = 0; val = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment