Skip to content

Commit

Permalink
staging: brcm80211: fix off-by-one error in swap functions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Henry Ptasinski authored and Greg Kroah-Hartman committed Aug 23, 2011
1 parent c9be704 commit 8ac98a5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/staging/brcm80211/brcmsmac/srom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down

0 comments on commit 8ac98a5

Please sign in to comment.