Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1568045ybb; Sat, 4 Apr 2020 07:15:34 -0700 (PDT) X-Google-Smtp-Source: APiQypIK6LcQkopRyi2XYCDYL0P+Gh8LCg8M0dOUs5A2ERrtjlupwEksemPUKrGbYoplZ+P9cUjx X-Received: by 2002:aca:4243:: with SMTP id p64mr6886094oia.21.1586009734669; Sat, 04 Apr 2020 07:15:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586009734; cv=none; d=google.com; s=arc-20160816; b=oeWvaEnmGFk1LTdcMRKQtfjBozt+XkhbOW9zv7bCEq7DsQ0+IHHtVbHXTssrJf7yaO CN3A/cYjxQyF2/zaV3SU6edbMd1QVW8g0PhqRWAcsITCvjMPs2lmKyKRnVvhhJm95iIZ s7FhRHwPaJeTjkJcCFyleijRz3uMZNvn9JqcbDhBpjvhr36WUdRlviBVXqAFKkmE6jtW 4fwQ9bC9zK7q+xFvm3Bqx2u73m0ye2W9ldiaWpUWCjsSfwUWsY84RuB8fF8rsV1wu2Bl FunxhBqkgVd8WLdI5to06kQzFd52eACL/MDFY/WblMmvZFBuUcrbdgnkW1/7fnI4oi/+ 5rIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JGQD4fxj3rTr9HrBZGdMyVOQH73Te90soGBiPdZwiQc=; b=hm1LxY81sKyOJsyg11owc5nPkqv54IXM/SRHgRDEU58LeYYTL9BsVB6ExLvH8q2LNF D+tJKepeDaK/5in2xwVf0hU0EUalMn2i6VvferVbUtLigSEncpi1ksBK/hD25MWuRNc5 ad4jZP+EZz5vSjd2laBRIEYWgXY6MkZ+0KyXU9gcQhHbB8qEemUPdeKXcKWQP2FTDllz s7SFfONNRsh5m724mbXXfep9TWHKWl0N9XcLtbBnVa1sgSR7knDZr7CkAnXDA1ifhq2m x7UWzAEYl1xSU0Wy6BGHVd7jTpUMOCaoXlfMhvjnKHVsK6bPwLcoJf0ZbOHNrU7GB1+m Oqwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=LjVijot4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w16si4824929otq.235.2020.04.04.07.15.22; Sat, 04 Apr 2020 07:15:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=LjVijot4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726406AbgDDOOw (ORCPT + 99 others); Sat, 4 Apr 2020 10:14:52 -0400 Received: from mout.gmx.net ([212.227.17.21]:33609 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726039AbgDDOOv (ORCPT ); Sat, 4 Apr 2020 10:14:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1586009685; bh=WSffiIyo51Rojwse2fXv4RYk6E6kNLfPBGNLqeexlHk=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=LjVijot4U0EN3EqFYTvfjw2RSsUaVbO1DGZU/xuh/en1vhe36Hfu5zSemQ4fupf87 3nkm3WgrXVqbiUIz54upGmMN5cDKJ1sTe7M9sdu8Gci7vVaxddCaTW1ssrG+ZVY6qS jBWqTGKpN92+gkL8Vl3DPQ12jzLT7cUPVyR3eWQk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([83.52.229.196]) by mail.gmx.com (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MbRjt-1ijU4q1E9h-00bovg; Sat, 04 Apr 2020 16:14:45 +0200 From: Oscar Carter To: Forest Bond , Greg Kroah-Hartman Cc: Oscar Carter , Malcolm Priestley , Quentin Deslandes , Amir Mahdi Ghorbanian , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] staging: vt6656: Use ARRAY_SIZE instead of define RATE_54M Date: Sat, 4 Apr 2020 16:13:58 +0200 Message-Id: <20200404141400.3772-2-oscar.carter@gmx.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200404141400.3772-1-oscar.carter@gmx.com> References: <20200404141400.3772-1-oscar.carter@gmx.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:CMfo5+R6LSyz6GmD+T60rQ6fSDRfJVJ3lHLwc5LtnFIKQIP1NCo PjAqyHUEpaaM7ANcDBj0rImcW1QWq6cWluqni/W7otViwxeIwtWIkTb/se4z0hQtvd+BPlm 0b9O/ySmfzqNG6p7mQQwD5o342ddCcNPqsaixKXlwsPNKeST2Ga6c3D8mMsh2L4SOkbTbl0 HQaURs/dhWE67vZ9l46bQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:ai4Bj2d9d6M=:nQLpHR/oVT1o2HdpbrKvgL d/E3zD9Be9tcY6z5RyTUOBHygYdJ1r8lQNwKR9ju7rkNylwoPlj64A8zV0O1ASk3V5c+BH8yz tWWRMCjodMUP1rqpuMeXH5J4yXzcPixih0+jO1tkxZmviqTOT3nVvUEpVop5jMNVLRZ2qHObI 6YNrbMbrZt0pCU2zQe7C3i6D+4or5UbCLgFSLzWy2fPlsGbSNBBFLMMNP7cZnrlxjwPpvUyDq qYr8rO4yPVycGxBbHv19w4r9RZD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linux-kernel@vger.kernel.org Use ARRAY_SIZE to replace the define RATE_54M so we will never have a mismatch. In this way, avoid the possibility of a buffer overflow if this define is changed in the future to a greater value. Signed-off-by: Oscar Carter =2D-- drivers/staging/vt6656/baseband.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/ba= seband.c index a19a563d8bcc..3e4bd637849a 100644 =2D-- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -136,7 +136,7 @@ unsigned int vnt_get_frame_time(u8 preamble_type, u8 p= kt_type, unsigned int preamble; unsigned int rate =3D 0; - if (tx_rate > RATE_54M) + if (tx_rate >=3D ARRAY_SIZE(vnt_frame_time)) return 0; rate =3D (unsigned int)vnt_frame_time[tx_rate]; =2D- 2.20.1