Messages in this thread Patch in this message | | | From | Oscar Carter <> | Subject | [PATCH 1/3] staging: vt6656: Use ARRAY_SIZE instead of define RATE_54M | Date | Sat, 4 Apr 2020 16:13:58 +0200 |
| |
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
| |