From: Martin Kaiser <martin@kaiser.cx>
Date: Sun, 17 Apr 2022 10:22:21 +0000 (+0200)
Subject: staging: r8188eu: use ARRAY_SIZE for mlme_sta_tbl
X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=db84803cd8def406c60eb865d3b4ae0efa09a9f8;p=linux.git

staging: r8188eu: use ARRAY_SIZE for mlme_sta_tbl

Use ARRAY_SIZE instead of hard-coding the number of entries in the
mlme_sta_tbl array.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220417102221.466524-7-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
index 6896379402a21..6b3d983bf91cc 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
@@ -404,7 +404,7 @@ void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame)
 		return;
 
 	index = (le16_to_cpu(hdr->frame_control) & IEEE80211_FCTL_STYPE) >> 4;
-	if (index > 13)
+	if (index > ARRAY_SIZE(mlme_sta_tbl))
 		return;
 	fct = mlme_sta_tbl[index];