diff options
author | Julia Lawall <julia@diku.dk> | 2009-12-13 16:07:45 (GMT) |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-12-21 16:32:02 (GMT) |
commit | 855da5e07ef4dba5f23d8f6f31004116ba16c52a (patch) | |
tree | e9c66e33825d930a488a642dbd29c1c3ab44a738 /drivers/net | |
parent | 4d91f9f3730d6d82a3ba67cae215a1823ba6a191 (diff) | |
download | linux-fsl-qoriq-855da5e07ef4dba5f23d8f6f31004116ba16c52a.tar.xz |
drivers/net/wireless: Correct code taking the size of a pointer
sizeof(iv16) and sizeof(iv32) are the sizes of pointers. Change them to
the size of the copied data.
Furthermore, iveiv_entry is a local structure that has just been
initialized and is not visible outside this function. Thus, there would
seem to be no point to copy data into it. The order of the arguments is
thus changed to copy the data into the parameters, which are provided as
pointers, suggesting in this case that they should be used to return values.
A simplified version of the semantic patch that finds the first 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>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | 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 6e13650..a199f85 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(iv16, &iveiv_entry.iv[0], sizeof(*iv16)); + memcpy(iv32, &iveiv_entry.iv[4], sizeof(*iv32)); } static int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value) |