lkml.org 
[lkml]   [2020]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/3] staging: vt6656: Use ARRAY_SIZE instead of define RATE_54M
Date
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@gmx.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
\
 
 \ /
  Last update: 2020-04-04 16:15    [W:0.061 / U:0.908 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site