From patchwork Wed Feb 5 18:31:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryder Lee X-Patchwork-Id: 11366977 X-Patchwork-Delegate: nbd@nbd.name Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B9CAF92A for ; Wed, 5 Feb 2020 18:31:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 875E520674 for ; Wed, 5 Feb 2020 18:31:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="oVpRXewE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727452AbgBESbx (ORCPT ); Wed, 5 Feb 2020 13:31:53 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:16639 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727309AbgBESbx (ORCPT ); Wed, 5 Feb 2020 13:31:53 -0500 X-UUID: d94d3524aa2e478aa8d6672e92ac9058-20200206 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=xxlgbnU5pSZKUH3JfH939pFWVo6iRlJ+wxus9Y1Vfak=; b=oVpRXewEMkQmz2lTlwRsfnqfUx21siz6lK1fuRA3uB+rqi2tmsBsmWWk7OUhpLPzfYtDHE05OLFxmls5ljN1MTUs9ZprC/LuzgUHMDgoPQgIgchJie9kB7F6EI+5CVSelUT+jqgjPchNvJqh0VNpBoTH2zRg6NfePbjM39fCLvc=; X-UUID: d94d3524aa2e478aa8d6672e92ac9058-20200206 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 2026006206; Thu, 06 Feb 2020 02:31:48 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 6 Feb 2020 02:32:46 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 6 Feb 2020 02:31:22 +0800 From: Ryder Lee To: Felix Fietkau , Lorenzo Bianconi CC: Shayne Chen , Sean Wang , Evelyn Tsai , Chih-Min Chen , , , Ryder Lee Subject: [PATCH v2] mt76: mt7615: set proper length in strncmp Date: Thu, 6 Feb 2020 02:31:19 +0800 Message-ID: <06da8143b6baa77295abaf70907fb8e345e15e0e.1580927122.git.ryder.lee@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Use sizeof(hdr->fw_ver) as max len. Signed-off-by: Ryder Lee --- changes since v2 - use sizeof() instead. --- 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..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;