Skip to content

Commit

Permalink
b43: Don't use memcpy for overlapping areas
Browse files Browse the repository at this point in the history
It is valid to pass &gphy->rfatt and &gphy->bbatt as rfatt and bbatt
pointer arguments to the function. So we have to use memmove for the
possibly overlapping memory areas.

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Michael Buesch authored and John W. Linville committed Sep 5, 2008
1 parent a505f4f commit fa9abe0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/net/wireless/b43/phy_g.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,12 @@ void b43_set_txpower_g(struct b43_wldev *dev,
if (unlikely(tx_bias == 0xFF))
tx_bias = 0;

/* Save the values for later */
/* Save the values for later. Use memmove, because it's valid
* to pass &gphy->rfatt as rfatt pointer argument. Same for bbatt. */
gphy->tx_control = tx_control;
memcpy(&gphy->rfatt, rfatt, sizeof(*rfatt));
memmove(&gphy->rfatt, rfatt, sizeof(*rfatt));
gphy->rfatt.with_padmix = !!(tx_control & B43_TXCTL_TXMIX);
memcpy(&gphy->bbatt, bbatt, sizeof(*bbatt));
memmove(&gphy->bbatt, bbatt, sizeof(*bbatt));

if (b43_debug(dev, B43_DBG_XMITPOWER)) {
b43dbg(dev->wl, "Tuning TX-power to bbatt(%u), "
Expand Down

0 comments on commit fa9abe0

Please sign in to comment.