* [PATCH] staging: wilc1000: fix incorrect copy of pmkid data
@ 2017-03-16 23:21 Colin King
2017-03-17 8:35 ` walter harms
2017-04-07 23:44 ` [PATCH] staging: wilc1000: fix incorrect strncasecmp length Colin King
0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2017-03-16 23:21 UTC (permalink / raw)
To: Aditya Shankar, Ganesh Krishna, Greg Kroah-Hartman,
linux-wireless, devel
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The pmkid data is meant be be copied to the previous item in the
pmkidlist, however the code is just copying the data to itself because
the src index into pmkidlist is the same as the dst index into pmkidlist.
Fix this with i + 1 instead of i.
Detected by CoverityScan,CID#13339465 ("Overlapping buffer in memory copy")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index a37896f..4034f40 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1346,7 +1346,7 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
priv->pmkid_list.pmkidlist[i + 1].bssid,
ETH_ALEN);
memcpy(priv->pmkid_list.pmkidlist[i].pmkid,
- priv->pmkid_list.pmkidlist[i].pmkid,
+ priv->pmkid_list.pmkidlist[i + 1].pmkid,
PMKID_LEN);
}
priv->pmkid_list.numpmkid--;
--
2.10.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: wilc1000: fix incorrect copy of pmkid data
2017-03-16 23:21 [PATCH] staging: wilc1000: fix incorrect copy of pmkid data Colin King
@ 2017-03-17 8:35 ` walter harms
2017-04-07 23:44 ` [PATCH] staging: wilc1000: fix incorrect strncasecmp length Colin King
1 sibling, 0 replies; 3+ messages in thread
From: walter harms @ 2017-03-17 8:35 UTC (permalink / raw)
To: Colin King
Cc: Aditya Shankar, Ganesh Krishna, Greg Kroah-Hartman,
linux-wireless, devel, kernel-janitors, linux-kernel
Am 17.03.2017 00:21, schrieb Colin King:
> From: Colin Ian King <colin.king@canonical.com>
>
> The pmkid data is meant be be copied to the previous item in the
> pmkidlist, however the code is just copying the data to itself because
> the src index into pmkidlist is the same as the dst index into pmkidlist.
> Fix this with i + 1 instead of i.
>
> Detected by CoverityScan,CID#13339465 ("Overlapping buffer in memory copy")
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> index a37896f..4034f40 100644
> --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> @@ -1346,7 +1346,7 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
> priv->pmkid_list.pmkidlist[i + 1].bssid,
> ETH_ALEN);
> memcpy(priv->pmkid_list.pmkidlist[i].pmkid,
> - priv->pmkid_list.pmkidlist[i].pmkid,
> + priv->pmkid_list.pmkidlist[i + 1].pmkid,
> PMKID_LEN);
> }
> priv->pmkid_list.numpmkid--;
perhaps we can also simplify the error handling:
that would reduce the indentlevel by one and effectivly remove the s32Error variable.
if (i >= priv->pmkid_list.numpmkid || priv->pmkid_list.numpmkid <= 0)
return -EINVAL;
just my 2 cents.
re,
wh
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] staging: wilc1000: fix incorrect strncasecmp length
2017-03-16 23:21 [PATCH] staging: wilc1000: fix incorrect copy of pmkid data Colin King
2017-03-17 8:35 ` walter harms
@ 2017-04-07 23:44 ` Colin King
1 sibling, 0 replies; 3+ messages in thread
From: Colin King @ 2017-04-07 23:44 UTC (permalink / raw)
To: Aditya Shankar, Ganesh Krishna, Greg Kroah-Hartman,
linux-wireless, devel
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The strncasecmp of buff against the literal string RSSI
is using variable length which is zero. This should be instead
using the variable size instead. Also remove the redundant
variable length.
Detected by PVS-Studio, warning: V575
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/staging/wilc1000/linux_wlan.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 2eebc6215cac..6aeaf19182e7 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1074,7 +1074,7 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
{
u8 *buff = NULL;
s8 rssi;
- u32 size = 0, length = 0;
+ u32 size = 0;
struct wilc_vif *vif;
s32 ret = 0;
struct wilc *wilc;
@@ -1098,7 +1098,7 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
if (IS_ERR(buff))
return PTR_ERR(buff);
- if (strncasecmp(buff, "RSSI", length) = 0) {
+ if (strncasecmp(buff, "RSSI", size) = 0) {
ret = wilc_get_rssi(vif, &rssi);
netdev_info(ndev, "RSSI :%d\n", rssi);
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-07 23:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-16 23:21 [PATCH] staging: wilc1000: fix incorrect copy of pmkid data Colin King
2017-03-17 8:35 ` walter harms
2017-04-07 23:44 ` [PATCH] staging: wilc1000: fix incorrect strncasecmp length Colin King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).