Search Linux Wireless

[PATCH 6/8] staging: brcm80211: bugfix for exception on Sparc platforms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Roland Vossen <rvossen@xxxxxxxxxxxx>

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 <arend@xxxxxxxxxxxx>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@xxxxxxxxxxxx>
Signed-off-by: Arend van Spriel <arend@xxxxxxxxxxxx>
---
 drivers/staging/brcm80211/brcmsmac/main.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index c625c25..7e729d29 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;
 
-- 
1.7.4.1


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux