* [PATCH] staging: ks7010: remove redundant variable eth_proto @ 2018-07-11 10:59 ` Colin King 0 siblings, 0 replies; 9+ messages in thread From: Colin King @ 2018-07-11 10:59 UTC (permalink / raw) To: Greg Kroah-Hartman, Sergio Paracuellos, devel Cc: kernel-janitors, linux-kernel From: Colin Ian King <colin.king@canonical.com> Variable eth_proto is being assigned but is never used hence it is redundant and can be removed. Cleans up clang warning: warning: variable 'eth_proto' set but not used [-Wunused-but-set-variable] Signed-off-by: Colin Ian King <colin.king@canonical.com> --- drivers/staging/ks7010/ks_hostif.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 0ecffab52ec2..a85975f63d26 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -354,7 +354,6 @@ void hostif_data_indication(struct ks_wlan_private *priv) u16 auth_type; unsigned char temp[256]; struct ether_hdr *eth_hdr; - unsigned short eth_proto; struct ieee802_1x_hdr *aa1x_hdr; size_t size; int ret; @@ -369,7 +368,6 @@ void hostif_data_indication(struct ks_wlan_private *priv) get_word(priv); /* Reserve Area */ eth_hdr = (struct ether_hdr *)(priv->rxp); - eth_proto = ntohs(eth_hdr->h_proto); /* source address check */ if (ether_addr_equal(&priv->eth_addr[0], eth_hdr->h_source)) { -- 2.17.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH] staging: ks7010: remove redundant variable eth_proto @ 2018-07-11 10:59 ` Colin King 0 siblings, 0 replies; 9+ messages in thread From: Colin King @ 2018-07-11 10:59 UTC (permalink / raw) To: Greg Kroah-Hartman, Sergio Paracuellos, devel Cc: kernel-janitors, linux-kernel From: Colin Ian King <colin.king@canonical.com> Variable eth_proto is being assigned but is never used hence it is redundant and can be removed. Cleans up clang warning: warning: variable 'eth_proto' set but not used [-Wunused-but-set-variable] Signed-off-by: Colin Ian King <colin.king@canonical.com> --- drivers/staging/ks7010/ks_hostif.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 0ecffab52ec2..a85975f63d26 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -354,7 +354,6 @@ void hostif_data_indication(struct ks_wlan_private *priv) u16 auth_type; unsigned char temp[256]; struct ether_hdr *eth_hdr; - unsigned short eth_proto; struct ieee802_1x_hdr *aa1x_hdr; size_t size; int ret; @@ -369,7 +368,6 @@ void hostif_data_indication(struct ks_wlan_private *priv) get_word(priv); /* Reserve Area */ eth_hdr = (struct ether_hdr *)(priv->rxp); - eth_proto = ntohs(eth_hdr->h_proto); /* source address check */ if (ether_addr_equal(&priv->eth_addr[0], eth_hdr->h_source)) { -- 2.17.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH] staging: ks7010: remove redundant auth_type check @ 2019-03-18 10:57 ` Colin King 0 siblings, 0 replies; 9+ messages in thread From: Colin King @ 2019-03-18 10:57 UTC (permalink / raw) To: Greg Kroah-Hartman, Sergio Paracuellos, Quytelda Kahja, Jeremy Sowden, devel Cc: kernel-janitors, linux-kernel From: Colin Ian King <colin.king@canonical.com> 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_GMK1. Hence the auth_type check can be removed. Detected by static analysis with cppcheck. Signed-off-by: Colin Ian King <colin.king@canonical.com> --- drivers/staging/ks7010/ks_hostif.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 06ebea0be118..31a536791d5c 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -362,6 +362,8 @@ int hostif_data_indication_wpa(struct ks_wlan_private *priv, (auth_type = TYPE_GMK2 && priv->wpa.group_suite = IW_AUTH_CIPHER_TKIP)) && key->key_len) { + int ret; + netdev_dbg(priv->net_dev, "TKIP: protocol=%04X: size=%u\n", eth_proto, priv->rx_size); /* MIC save */ @@ -369,15 +371,11 @@ int hostif_data_indication_wpa(struct ks_wlan_private *priv, (priv->rxp) + ((priv->rx_size) - sizeof(recv_mic)), 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, - priv->rxp, priv->rx_size, - 0, mic); - if (ret < 0) - return ret; - } + + ret = michael_mic(key->rx_mic_key, priv->rxp, priv->rx_size, + 0, mic); + if (ret < 0) + return ret; if (memcmp(mic, recv_mic, sizeof(mic)) != 0) { now = jiffies; mic_failure = &priv->wpa.mic_failure; -- 2.20.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH] staging: ks7010: remove redundant auth_type check @ 2019-03-18 10:57 ` Colin King 0 siblings, 0 replies; 9+ messages in thread From: Colin King @ 2019-03-18 10:57 UTC (permalink / raw) To: Greg Kroah-Hartman, Sergio Paracuellos, Quytelda Kahja, Jeremy Sowden, devel Cc: kernel-janitors, linux-kernel From: Colin Ian King <colin.king@canonical.com> 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_GMK1. Hence the auth_type check can be removed. Detected by static analysis with cppcheck. Signed-off-by: Colin Ian King <colin.king@canonical.com> --- drivers/staging/ks7010/ks_hostif.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 06ebea0be118..31a536791d5c 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -362,6 +362,8 @@ int hostif_data_indication_wpa(struct ks_wlan_private *priv, (auth_type == TYPE_GMK2 && priv->wpa.group_suite == IW_AUTH_CIPHER_TKIP)) && key->key_len) { + int ret; + netdev_dbg(priv->net_dev, "TKIP: protocol=%04X: size=%u\n", eth_proto, priv->rx_size); /* MIC save */ @@ -369,15 +371,11 @@ int hostif_data_indication_wpa(struct ks_wlan_private *priv, (priv->rxp) + ((priv->rx_size) - sizeof(recv_mic)), 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, - priv->rxp, priv->rx_size, - 0, mic); - if (ret < 0) - return ret; - } + + ret = michael_mic(key->rx_mic_key, priv->rxp, priv->rx_size, + 0, mic); + if (ret < 0) + return ret; if (memcmp(mic, recv_mic, sizeof(mic)) != 0) { now = jiffies; mic_failure = &priv->wpa.mic_failure; -- 2.20.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] staging: ks7010: remove redundant auth_type check 2019-03-18 10:57 ` Colin King @ 2019-03-18 21:32 ` Jeremy Sowden -1 siblings, 0 replies; 9+ messages in thread From: Jeremy Sowden @ 2019-03-18 21:32 UTC (permalink / raw) To: Colin King Cc: Greg Kroah-Hartman, Sergio Paracuellos, Quytelda Kahja, devel, kernel-janitors, linux-kernel On 2019-03-18, at 10:57:49 +0000, Colin King wrote: > 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_GMK1. "... and TYPE_GMK2." > Hence the auth_type check can be removed. > > Detected by static analysis with cppcheck. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > drivers/staging/ks7010/ks_hostif.c | 16 +++++++--------- > 1 file changed, 7 insertions(+), 9 deletions(-) > > diff --git a/drivers/staging/ks7010/ks_hostif.c > b/drivers/staging/ks7010/ks_hostif.c > index 06ebea0be118..31a536791d5c 100644 > --- a/drivers/staging/ks7010/ks_hostif.c > +++ b/drivers/staging/ks7010/ks_hostif.c > @@ -362,6 +362,8 @@ int hostif_data_indication_wpa(struct > ks_wlan_private *priv, > (auth_type = TYPE_GMK2 && > priv->wpa.group_suite = IW_AUTH_CIPHER_TKIP)) && > key->key_len) { > + int ret; > + > netdev_dbg(priv->net_dev, "TKIP: protocol=%04X: size=%u\n", > eth_proto, priv->rx_size); > /* MIC save */ > @@ -369,15 +371,11 @@ int hostif_data_indication_wpa(struct > ks_wlan_private *priv, > (priv->rxp) + ((priv->rx_size) - sizeof(recv_mic)), > 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, > - priv->rxp, priv->rx_size, > - 0, mic); > - if (ret < 0) > - return ret; > - } > + > + ret = michael_mic(key->rx_mic_key, priv->rxp, priv->rx_size, > + 0, mic); > + if (ret < 0) > + return ret; > if (memcmp(mic, recv_mic, sizeof(mic)) != 0) { > now = jiffies; > mic_failure = &priv->wpa.mic_failure; Acked-by: Jeremy Sowden <jeremy@azazel.net> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] staging: ks7010: remove redundant auth_type check @ 2019-03-18 21:32 ` Jeremy Sowden 0 siblings, 0 replies; 9+ messages in thread From: Jeremy Sowden @ 2019-03-18 21:32 UTC (permalink / raw) To: Colin King Cc: Greg Kroah-Hartman, Sergio Paracuellos, Quytelda Kahja, devel, kernel-janitors, linux-kernel On 2019-03-18, at 10:57:49 +0000, Colin King wrote: > 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_GMK1. "... and TYPE_GMK2." > Hence the auth_type check can be removed. > > Detected by static analysis with cppcheck. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > drivers/staging/ks7010/ks_hostif.c | 16 +++++++--------- > 1 file changed, 7 insertions(+), 9 deletions(-) > > diff --git a/drivers/staging/ks7010/ks_hostif.c > b/drivers/staging/ks7010/ks_hostif.c > index 06ebea0be118..31a536791d5c 100644 > --- a/drivers/staging/ks7010/ks_hostif.c > +++ b/drivers/staging/ks7010/ks_hostif.c > @@ -362,6 +362,8 @@ int hostif_data_indication_wpa(struct > ks_wlan_private *priv, > (auth_type == TYPE_GMK2 && > priv->wpa.group_suite == IW_AUTH_CIPHER_TKIP)) && > key->key_len) { > + int ret; > + > netdev_dbg(priv->net_dev, "TKIP: protocol=%04X: size=%u\n", > eth_proto, priv->rx_size); > /* MIC save */ > @@ -369,15 +371,11 @@ int hostif_data_indication_wpa(struct > ks_wlan_private *priv, > (priv->rxp) + ((priv->rx_size) - sizeof(recv_mic)), > 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, > - priv->rxp, priv->rx_size, > - 0, mic); > - if (ret < 0) > - return ret; > - } > + > + ret = michael_mic(key->rx_mic_key, priv->rxp, priv->rx_size, > + 0, mic); > + if (ret < 0) > + return ret; > if (memcmp(mic, recv_mic, sizeof(mic)) != 0) { > now = jiffies; > mic_failure = &priv->wpa.mic_failure; Acked-by: Jeremy Sowden <jeremy@azazel.net> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] staging: ks7010: remove redundant auth_type check 2019-03-18 21:32 ` Jeremy Sowden @ 2019-03-19 13:29 ` Greg Kroah-Hartman -1 siblings, 0 replies; 9+ messages in thread From: Greg Kroah-Hartman @ 2019-03-19 13:29 UTC (permalink / raw) To: Jeremy Sowden Cc: Colin King, devel, kernel-janitors, linux-kernel, Quytelda Kahja On Mon, Mar 18, 2019 at 09:32:59PM +0000, Jeremy Sowden wrote: > On 2019-03-18, at 10:57:49 +0000, Colin King wrote: > > 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_GMK1. > > "... and TYPE_GMK2." I'll go edit that, thanks. greg k-h ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] staging: ks7010: remove redundant auth_type check @ 2019-03-19 13:29 ` Greg Kroah-Hartman 0 siblings, 0 replies; 9+ messages in thread From: Greg Kroah-Hartman @ 2019-03-19 13:29 UTC (permalink / raw) To: Jeremy Sowden Cc: Colin King, devel, kernel-janitors, linux-kernel, Quytelda Kahja On Mon, Mar 18, 2019 at 09:32:59PM +0000, Jeremy Sowden wrote: > On 2019-03-18, at 10:57:49 +0000, Colin King wrote: > > 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_GMK1. > > "... and TYPE_GMK2." I'll go edit that, thanks. greg k-h ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] staging: ks7010: remove redundant auth_type check 2019-03-19 13:29 ` Greg Kroah-Hartman (?) @ 2019-03-19 13:51 ` Colin Ian King -1 siblings, 0 replies; 9+ messages in thread From: Colin Ian King @ 2019-03-19 13:51 UTC (permalink / raw) To: Greg Kroah-Hartman, Jeremy Sowden Cc: devel, kernel-janitors, linux-kernel, Quytelda Kahja On 19/03/2019 13:29, Greg Kroah-Hartman wrote: > On Mon, Mar 18, 2019 at 09:32:59PM +0000, Jeremy Sowden wrote: >> On 2019-03-18, at 10:57:49 +0000, Colin King wrote: >>> 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_GMK1. >> >> "... and TYPE_GMK2." > > I'll go edit that, thanks. > > greg k-h > Thanks for fixing my typo. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2019-03-19 13:51 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-07-11 10:59 [PATCH] staging: ks7010: remove redundant variable eth_proto Colin King 2018-07-11 10:59 ` Colin King 2019-03-18 10:57 ` [PATCH] staging: ks7010: remove redundant auth_type check Colin King 2019-03-18 10:57 ` Colin King 2019-03-18 21:32 ` Jeremy Sowden 2019-03-18 21:32 ` Jeremy Sowden 2019-03-19 13:29 ` Greg Kroah-Hartman 2019-03-19 13:29 ` Greg Kroah-Hartman 2019-03-19 13:51 ` Colin Ian King
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.