diff mbox series

[v2] mt76: mt7615: set proper length in strncmp

Message ID 06da8143b6baa77295abaf70907fb8e345e15e0e.1580927122.git.ryder.lee@mediatek.com (mailing list archive)
State Accepted
Delegated to: Felix Fietkau
Headers show
Series [v2] mt76: mt7615: set proper length in strncmp | expand

Commit Message

Ryder Lee Feb. 5, 2020, 6:31 p.m. UTC
Use sizeof(hdr->fw_ver) as max len.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
changes since v2 - use sizeof() instead.
---
 drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
index 6639f9291721..c3c01e095926 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", sizeof(hdr->fw_ver)))
 		dev->fw_ver = MT7615_FIRMWARE_V2;
 	else
 		dev->fw_ver = MT7615_FIRMWARE_V1;