mwifiex: fix 'smatch' warning in preparing key_material cmd

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sat Sep 29 10:59:31 EDT 2012


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=641c869d40c7ec6a34930843f41e95bf1f53f29f
Commit:     641c869d40c7ec6a34930843f41e95bf1f53f29f
Parent:     902d9e0f48ddc18fb37c1b1edf5e3b27aaba1505
Author:     Bing Zhao <bzhao at marvell.com>
AuthorDate: Wed Aug 8 19:01:52 2012 -0700
Committer:  John W. Linville <linville at tuxdriver.com>
CommitDate: Fri Aug 10 15:27:03 2012 -0400

    mwifiex: fix 'smatch' warning in preparing key_material cmd
    
    The key length can be 32 bytes for TKIP and 16 bytes for AES_CMAC.
    'smatch' warns on memcpy using key_len variable to copy data to
    a 16 bytes buffer. Use fixed length to avoid the warning.
    
    Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
    Signed-off-by: Bing Zhao <bzhao at marvell.com>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>
---
 drivers/net/wireless/mwifiex/sta_cmd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c b/drivers/net/wireless/mwifiex/sta_cmd.c
index 9af9692..0cc3406 100644
--- a/drivers/net/wireless/mwifiex/sta_cmd.c
+++ b/drivers/net/wireless/mwifiex/sta_cmd.c
@@ -690,7 +690,7 @@ mwifiex_cmd_802_11_key_material(struct mwifiex_private *priv,
 
 			memcpy(param->ipn, enc_key->pn, IGTK_PN_LEN);
 			memcpy(param->key, enc_key->key_material,
-			       enc_key->key_len);
+			       WLAN_KEY_LEN_AES_CMAC);
 
 			key_param_len = sizeof(struct mwifiex_cmac_param);
 			key_material->key_param_set.key_len =



More information about the linux-mtd-cvs mailing list