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: 216518 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_BASE64_TEXT, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF9DEC35247 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 A49FC21741 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(-) -- 2.18.0 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;