mt76: mt7615: fix wrong length in strncmp
diff mbox series

Message ID cee34bac9d6041784a92c5fdbf667c367dc7f968.1580874252.git.ryder.lee@mediatek.com
State New
Headers show
Series
  • mt76: mt7615: fix wrong length in strncmp
Related show

Commit Message

Ryder Lee Feb. 5, 2020, 3:46 a.m. UTC
Fix it to proper length.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Felix Fietkau Feb. 5, 2020, 8:19 a.m. UTC | #1
On 2020-02-05 04:46, Ryder Lee wrote:
> Fix it to proper length.
> 
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> ---
>  drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> index 6639f9291721..fbda56342d11 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> @@ -491,7 +491,7 @@ static int mt7615_load_ram(struct mt7615_dev *dev)
>  		goto out;
>  	}
>  
> -	if (!strncmp(hdr->fw_ver, "2.0", 6))
> +	if (!strncmp(hdr->fw_ver, "2.0", 3))
Do you plan on allowing more characters after the 2.0 and still match?
If not, maybe we should just use sizeof(hdr->fw_ver) as max len.

- Felix

Patch
diff mbox series

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
index 6639f9291721..fbda56342d11 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
@@ -491,7 +491,7 @@  static int mt7615_load_ram(struct mt7615_dev *dev)
 		goto out;
 	}
 
-	if (!strncmp(hdr->fw_ver, "2.0", 6))
+	if (!strncmp(hdr->fw_ver, "2.0", 3))
 		dev->fw_ver = MT7615_FIRMWARE_V2;
 	else
 		dev->fw_ver = MT7615_FIRMWARE_V1;