Commit 7d6009f2 authored by Colin Ian King's avatar Colin Ian King Committed by Greg Kroah-Hartman

staging: ks7010: remove redundant auth_type check

The range check on auth_type is redundant as there is a prior
check on the auth_type values and the only way the block is entered
is if auth_type is one of TYPE_PMK1, TYPE_GMK1 and TYPE_GMK2. Hence
the auth_type check can be removed.

Detected by static analysis with cppcheck.
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Acked-by: default avatarJeremy Sowden <jeremy@azazel.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7f2c4396
...@@ -362,6 +362,8 @@ int hostif_data_indication_wpa(struct ks_wlan_private *priv, ...@@ -362,6 +362,8 @@ int hostif_data_indication_wpa(struct ks_wlan_private *priv,
(auth_type == TYPE_GMK2 && (auth_type == TYPE_GMK2 &&
priv->wpa.group_suite == IW_AUTH_CIPHER_TKIP)) && priv->wpa.group_suite == IW_AUTH_CIPHER_TKIP)) &&
key->key_len) { key->key_len) {
int ret;
netdev_dbg(priv->net_dev, "TKIP: protocol=%04X: size=%u\n", netdev_dbg(priv->net_dev, "TKIP: protocol=%04X: size=%u\n",
eth_proto, priv->rx_size); eth_proto, priv->rx_size);
/* MIC save */ /* MIC save */
...@@ -369,15 +371,11 @@ int hostif_data_indication_wpa(struct ks_wlan_private *priv, ...@@ -369,15 +371,11 @@ int hostif_data_indication_wpa(struct ks_wlan_private *priv,
(priv->rxp) + ((priv->rx_size) - sizeof(recv_mic)), (priv->rxp) + ((priv->rx_size) - sizeof(recv_mic)),
sizeof(recv_mic)); sizeof(recv_mic));
priv->rx_size = priv->rx_size - sizeof(recv_mic); priv->rx_size = priv->rx_size - sizeof(recv_mic);
if (auth_type > 0 && auth_type < 4) { /* auth_type check */
int ret;
ret = michael_mic(key->rx_mic_key, ret = michael_mic(key->rx_mic_key, priv->rxp, priv->rx_size,
priv->rxp, priv->rx_size,
0, mic); 0, mic);
if (ret < 0) if (ret < 0)
return ret; return ret;
}
if (memcmp(mic, recv_mic, sizeof(mic)) != 0) { if (memcmp(mic, recv_mic, sizeof(mic)) != 0) {
now = jiffies; now = jiffies;
mic_failure = &priv->wpa.mic_failure; mic_failure = &priv->wpa.mic_failure;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment