From: Roland Vossen Date: Tue, 23 Aug 2011 12:13:58 +0000 (+0200) Subject: staging: brcm80211: bugfix for exception on Sparc platforms X-Git-Tag: next-20110824~7^2~134 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=49d468f64d59016030c2835a423833e7b45ccce5;p=karo-tx-linux.git 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: Arend van Spriel Reviewed-by: Pieter-Paul Giesberts Signed-off-by: Arend van Spriel Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c index c625c2556aed..7e729d295d73 100644 --- a/drivers/staging/brcm80211/brcmsmac/main.c +++ b/drivers/staging/brcm80211/brcmsmac/main.c @@ -6111,9 +6111,12 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len, /* default argument is generic integer */ 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)) - memcpy(&val, pval, sizeof(val)); + memcpy((void *)&val, (void *)pval, sizeof(val)); else val = 0;