staging: wilc1000: removed unused static variables for gtk and ptk information
authorAjay Singh <ajay.kathat@microchip.com>
Mon, 23 Apr 2018 16:33:04 +0000 (22:03 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Apr 2018 13:54:13 +0000 (15:54 +0200)
Removed the unnecessary static variables used to store gtk and ptk
information. Key data stored in the params was never access using these
variables.

Variables given below are removed

g_add_gtk_key_params;
g_key_gtk_params;
g_add_ptk_key_params;
g_key_ptk_params;
g_key_wep_params;
g_ptk_keys_saved;
g_gtk_keys_saved;
g_wep_keys_saved;

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c

index f9a95f27c8722c37a50d7acd01af0dd8f3c87cb5..402f12eeba41856327ec3f01b3d4b8f36cff6293 100644 (file)
@@ -166,15 +166,6 @@ struct add_key_params {
        u8 *mac_addr;
 };
 
-static struct add_key_params g_add_gtk_key_params;
-static struct wilc_wfi_key g_key_gtk_params;
-static struct add_key_params g_add_ptk_key_params;
-static struct wilc_wfi_key g_key_ptk_params;
-static struct wilc_wfi_wep_key g_key_wep_params;
-static bool g_ptk_keys_saved;
-static bool g_gtk_keys_saved;
-static bool g_wep_keys_saved;
-
 #define AGING_TIME     (9 * 1000)
 #define during_ip_time 15000
 
@@ -739,12 +730,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
                        priv->WILC_WFI_wep_key_len[sme->key_idx] = sme->key_len;
                        memcpy(priv->WILC_WFI_wep_key[sme->key_idx], sme->key, sme->key_len);
 
-                       g_key_wep_params.key_len = sme->key_len;
-                       g_key_wep_params.key = kmalloc(sme->key_len, GFP_KERNEL);
-                       memcpy(g_key_wep_params.key, sme->key, sme->key_len);
-                       g_key_wep_params.key_idx = sme->key_idx;
-                       g_wep_keys_saved = true;
-
                        wilc_set_wep_default_keyid(vif, sme->key_idx);
                        wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len,
                                                 sme->key_idx);
@@ -754,12 +739,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
                        priv->WILC_WFI_wep_key_len[sme->key_idx] = sme->key_len;
                        memcpy(priv->WILC_WFI_wep_key[sme->key_idx], sme->key, sme->key_len);
 
-                       g_key_wep_params.key_len = sme->key_len;
-                       g_key_wep_params.key = kmalloc(sme->key_len, GFP_KERNEL);
-                       memcpy(g_key_wep_params.key, sme->key, sme->key_len);
-                       g_key_wep_params.key_idx = sme->key_idx;
-                       g_wep_keys_saved = true;
-
                        wilc_set_wep_default_keyid(vif, sme->key_idx);
                        wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len,
                                                 sme->key_idx);
@@ -1012,27 +991,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
                                        keylen = params->key_len - 16;
                                }
 
-                               if (!g_gtk_keys_saved && netdev == wl->vif[0]->ndev) {
-                                       g_add_gtk_key_params.key_idx = key_index;
-                                       g_add_gtk_key_params.pairwise = pairwise;
-                                       if (!mac_addr) {
-                                               g_add_gtk_key_params.mac_addr = NULL;
-                                       } else {
-                                               g_add_gtk_key_params.mac_addr = kmalloc(ETH_ALEN, GFP_KERNEL);
-                                               memcpy(g_add_gtk_key_params.mac_addr, mac_addr, ETH_ALEN);
-                                       }
-                                       g_key_gtk_params.key_len = params->key_len;
-                                       g_key_gtk_params.seq_len = params->seq_len;
-                                       g_key_gtk_params.key =  kmalloc(params->key_len, GFP_KERNEL);
-                                       memcpy(g_key_gtk_params.key, params->key, params->key_len);
-                                       if (params->seq_len > 0) {
-                                               g_key_gtk_params.seq =  kmalloc(params->seq_len, GFP_KERNEL);
-                                               memcpy(g_key_gtk_params.seq, params->seq, params->seq_len);
-                                       }
-                                       g_key_gtk_params.cipher = params->cipher;
-                                       g_gtk_keys_saved = true;
-                               }
-
                                wilc_add_rx_gtk(vif, params->key, keylen,
                                                key_index, params->seq_len,
                                                params->seq, rx_mic,
@@ -1045,27 +1003,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
                                        keylen = params->key_len - 16;
                                }
 
-                               if (!g_ptk_keys_saved && netdev == wl->vif[0]->ndev) {
-                                       g_add_ptk_key_params.key_idx = key_index;
-                                       g_add_ptk_key_params.pairwise = pairwise;
-                                       if (!mac_addr) {
-                                               g_add_ptk_key_params.mac_addr = NULL;
-                                       } else {
-                                               g_add_ptk_key_params.mac_addr = kmalloc(ETH_ALEN, GFP_KERNEL);
-                                               memcpy(g_add_ptk_key_params.mac_addr, mac_addr, ETH_ALEN);
-                                       }
-                                       g_key_ptk_params.key_len = params->key_len;
-                                       g_key_ptk_params.seq_len = params->seq_len;
-                                       g_key_ptk_params.key =  kmalloc(params->key_len, GFP_KERNEL);
-                                       memcpy(g_key_ptk_params.key, params->key, params->key_len);
-                                       if (params->seq_len > 0) {
-                                               g_key_ptk_params.seq =  kmalloc(params->seq_len, GFP_KERNEL);
-                                               memcpy(g_key_ptk_params.seq, params->seq, params->seq_len);
-                                       }
-                                       g_key_ptk_params.cipher = params->cipher;
-                                       g_ptk_keys_saved = true;
-                               }
-
                                wilc_add_ptk(vif, params->key, keylen,
                                             mac_addr, rx_mic, tx_mic,
                                             STATION_MODE, u8mode, key_index);
@@ -1095,13 +1032,6 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
        wl = vif->wilc;
 
        if (netdev == wl->vif[0]->ndev) {
-               g_ptk_keys_saved = false;
-               g_gtk_keys_saved = false;
-               g_wep_keys_saved = false;
-
-               kfree(g_key_wep_params.key);
-               g_key_wep_params.key = NULL;
-
                if (priv->wilc_gtk[key_index] != NULL) {
                        kfree(priv->wilc_gtk[key_index]->key);
                        priv->wilc_gtk[key_index]->key = NULL;
@@ -1120,16 +1050,6 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
                        kfree(priv->wilc_ptk[key_index]);
                        priv->wilc_ptk[key_index] = NULL;
                }
-
-               kfree(g_key_ptk_params.key);
-               g_key_ptk_params.key = NULL;
-               kfree(g_key_ptk_params.seq);
-               g_key_ptk_params.seq = NULL;
-
-               kfree(g_key_gtk_params.key);
-               g_key_gtk_params.key = NULL;
-               kfree(g_key_gtk_params.seq);
-               g_key_gtk_params.seq = NULL;
        }
 
        if (key_index >= 0 && key_index <= 3) {