[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 4 Apr 2020 16:13:58 +0200
From: Oscar Carter <oscar.carter@....com>
To: Forest Bond <forest@...ttletooquiet.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Oscar Carter <oscar.carter@....com>,
Malcolm Priestley <tvboxspy@...il.com>,
Quentin Deslandes <quentin.deslandes@...ev.co.uk>,
Amir Mahdi Ghorbanian <indigoomega021@...il.com>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH 1/3] staging: vt6656: Use ARRAY_SIZE instead of define RATE_54M
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 <oscar.carter@....com>
---
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/baseband.c
index a19a563d8bcc..3e4bd637849a 100644
--- 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 pkt_type,
unsigned int preamble;
unsigned int rate = 0;
- if (tx_rate > RATE_54M)
+ if (tx_rate >= ARRAY_SIZE(vnt_frame_time))
return 0;
rate = (unsigned int)vnt_frame_time[tx_rate];
--
2.20.1
Powered by blists - more mailing lists