staging: wilc1000: fix incorrect strncasecmp length
authorColin Ian King <colin.king@canonical.com>
Fri, 7 Apr 2017 23:44:03 +0000 (00:44 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 8 Apr 2017 11:00:44 +0000 (13:00 +0200)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/linux_wlan.c

index bdf11c9f44a8cf4af7d6e3904c3778a8ca3c238d..d6d803416be280a65e4179e70735c823c26d1726 100644 (file)
@@ -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);