diff options
author | Henry Ptasinski <henryp@broadcom.com> | 2011-08-15 15:34:21 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-08-23 13:08:05 -0700 |
commit | 8ac98a56fac0cafb56d900154ac4569a959011c0 (patch) | |
tree | 0d0e2328e19f46ff01eee3dbacd10e12b7dbc6c0 /drivers/staging/brcm80211 | |
parent | c9be7049ad7892d96011ee00fe430efb8f30b89b (diff) |
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: Henry Ptasinski <henryp@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Tested-by: Jonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/brcm80211')
-rw-r--r-- | drivers/staging/brcm80211/brcmsmac/srom.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/staging/brcm80211/brcmsmac/srom.c b/drivers/staging/brcm80211/brcmsmac/srom.c index 060f06fc144..7a17f598e49 100644 --- a/drivers/staging/brcm80211/brcmsmac/srom.c +++ b/drivers/staging/brcm80211/brcmsmac/srom.c @@ -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)); } |