Commit 8ac98a56 authored by Henry Ptasinski's avatar Henry Ptasinski Committed by Greg Kroah-Hartman
Browse files

staging: brcm80211: fix off-by-one error in swap functions



The original implementation iterated over the data in buf+1 through buf+size,
whereas it should have been over the data in buf through buf+size-1.

Tested on Mac G5 PPC and BCM63281.

Signed-off-by: default avatarHenry Ptasinski <henryp@broadcom.com>
Reviewed-by: default avatarArend van Spriel <arend@broadcom.com>
Reviewed-by: default avatarRoland Vossen <rvossen@broadcom.com>
Tested-by: default avatarJonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent c9be7049
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -880,13 +880,15 @@ int srom_var_init(struct si_pub *sih, void *curmap, char **vars, uint *count)

static inline void ltoh16_buf(u16 *buf, unsigned int size)
{
	for (size /= 2; size; size--)
	size /= 2;
	while (size--)
		*(buf + size) = le16_to_cpu(*(buf + size));
}

static inline void htol16_buf(u16 *buf, unsigned int size)
{
	for (size /= 2; size; size--)
	size /= 2;
	while (size--)
		*(buf + size) = cpu_to_le16(*(buf + size));
}