linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5/9] drivers/net/wireless: Correct code taking the size of a pointer
@ 2009-12-13 11:42 Julia Lawall
  2009-12-13 12:55 ` Andreas Schwab
  0 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2009-12-13 11:42 UTC (permalink / raw)
  To: Ivo van Doorn, Gertjan van Wingerde, John W. Linville,
	linux-wireless, users, netdev, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

sizeof(iv16) and sizeof(iv32) are the sizes of pointers.  Change them to
the size of the copied data.

A simplified version of the semantic patch that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression *x;
expression f;
type T;
@@

*f(...,(T)x,...)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/net/wireless/rt2x00/rt2800lib.c        |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index eb1e1d0..1e74732 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -2140,8 +2140,8 @@ static void rt2800_get_tkip_seq(struct ieee80211_hw *hw, u8 hw_key_idx,
 	rt2800_register_multiread(rt2x00dev, offset,
 				      &iveiv_entry, sizeof(iveiv_entry));
 
-	memcpy(&iveiv_entry.iv[0], iv16, sizeof(iv16));
-	memcpy(&iveiv_entry.iv[4], iv32, sizeof(iv32));
+	memcpy(&iveiv_entry.iv[0], iv16, sizeof(*iv16));
+	memcpy(&iveiv_entry.iv[4], iv32, sizeof(*iv32));
 }
 
 static int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value)

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-12-15 17:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-13 11:42 [PATCH 5/9] drivers/net/wireless: Correct code taking the size of a pointer Julia Lawall
2009-12-13 12:55 ` Andreas Schwab
2009-12-13 13:10   ` Julia Lawall
2009-12-13 16:07   ` Julia Lawall
2009-12-14 22:07     ` Gertjan van Wingerde
2009-12-15 17:09       ` Ivo van Doorn
2009-12-13 16:08   ` Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).