lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <2e02f646ab3f8058b159d6d790e202a0e4744af8.1616748885.git.fabioaiuto83@gmail.com>
Date:   Fri, 26 Mar 2021 10:09:08 +0100
From:   Fabio Aiuto <fabioaiuto83@...il.com>
To:     gregkh@...uxfoundation.org
Cc:     linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org,
        Fabio Aiuto <fabioaiuto83@...il.com>
Subject: [PATCH 01/15] staging: rtl8723bs: inlcude macros in a do..while loop in core/rtw_security.c

fix the following checkpatch warning:

ERROR: Macros starting with if should be enclosed by a do - while
loop to avoid possible if/else logic defects
33: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:33:
+#define WEP_SW_ENC_CNT_INC(sec, ra) \
--
ERROR: Macros starting with if should be enclosed by a do - while
loop to avoid possible if/else logic defects
41: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:41:
+#define WEP_SW_DEC_CNT_INC(sec, ra) \
--
ERROR: Macros starting with if should be enclosed by a do - while
loop to avoid possible if/else logic defects
49: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:49:
+#define TKIP_SW_ENC_CNT_INC(sec, ra) \
--
ERROR: Macros starting with if should be enclosed by a do - while
loop to avoid possible if/else logic defects
57: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:57:
+#define TKIP_SW_DEC_CNT_INC(sec, ra) \
--
ERROR: Macros starting with if should be enclosed by a do - while
loop to avoid possible if/else logic defects
65: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:65:
+#define AES_SW_ENC_CNT_INC(sec, ra) \
--
ERROR: Macros starting with if should be enclosed by a do - while
loop to avoid possible if/else logic defects
73: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:73:
+#define AES_SW_DEC_CNT_INC(sec, ra) \
--
ERROR: Macros with multiple statements should be enclosed in a
do - while loop
2082: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:2082:
+#define ROUND(i, d, s) \

Signed-off-by: Fabio Aiuto <fabioaiuto83@...il.com>
---
 drivers/staging/rtl8723bs/core/rtw_security.c | 94 +++++++++++--------
 1 file changed, 54 insertions(+), 40 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index 44e2b362c867..c92984fcf42d 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -31,52 +31,64 @@ const char *security_type_str(u8 value)
 
 #ifdef DBG_SW_SEC_CNT
 #define WEP_SW_ENC_CNT_INC(sec, ra) \
-	if (is_broadcast_mac_addr(ra)) \
-		sec->wep_sw_enc_cnt_bc++; \
-	else if (is_multicast_mac_addr(ra)) \
-		sec->wep_sw_enc_cnt_mc++; \
-	else \
-		sec->wep_sw_enc_cnt_uc++;
+	do { \
+		if (is_broadcast_mac_addr(ra)) \
+			sec->wep_sw_enc_cnt_bc++; \
+		else if (is_multicast_mac_addr(ra)) \
+			sec->wep_sw_enc_cnt_mc++; \
+		else \
+			sec->wep_sw_enc_cnt_uc++; \
+	} while (0)
 
 #define WEP_SW_DEC_CNT_INC(sec, ra) \
-	if (is_broadcast_mac_addr(ra)) \
-		sec->wep_sw_dec_cnt_bc++; \
-	else if (is_multicast_mac_addr(ra)) \
-		sec->wep_sw_dec_cnt_mc++; \
-	else \
-		sec->wep_sw_dec_cnt_uc++;
+	do { \
+		if (is_broadcast_mac_addr(ra)) \
+			sec->wep_sw_dec_cnt_bc++; \
+		else if (is_multicast_mac_addr(ra)) \
+			sec->wep_sw_dec_cnt_mc++; \
+		else \
+			sec->wep_sw_dec_cnt_uc++; \
+	} while (0)
 
 #define TKIP_SW_ENC_CNT_INC(sec, ra) \
-	if (is_broadcast_mac_addr(ra)) \
-		sec->tkip_sw_enc_cnt_bc++; \
-	else if (is_multicast_mac_addr(ra)) \
-		sec->tkip_sw_enc_cnt_mc++; \
-	else \
-		sec->tkip_sw_enc_cnt_uc++;
+	do { \
+		if (is_broadcast_mac_addr(ra)) \
+			sec->tkip_sw_enc_cnt_bc++; \
+		else if (is_multicast_mac_addr(ra)) \
+			sec->tkip_sw_enc_cnt_mc++; \
+		else \
+			sec->tkip_sw_enc_cnt_uc++; \
+	} while (0)
 
 #define TKIP_SW_DEC_CNT_INC(sec, ra) \
-	if (is_broadcast_mac_addr(ra)) \
-		sec->tkip_sw_dec_cnt_bc++; \
-	else if (is_multicast_mac_addr(ra)) \
-		sec->tkip_sw_dec_cnt_mc++; \
-	else \
-		sec->tkip_sw_dec_cnt_uc++;
+	do { \
+		if (is_broadcast_mac_addr(ra)) \
+			sec->tkip_sw_dec_cnt_bc++; \
+		else if (is_multicast_mac_addr(ra)) \
+			sec->tkip_sw_dec_cnt_mc++; \
+		else \
+			sec->tkip_sw_dec_cnt_uc++; \
+	} while (0)
 
 #define AES_SW_ENC_CNT_INC(sec, ra) \
-	if (is_broadcast_mac_addr(ra)) \
-		sec->aes_sw_enc_cnt_bc++; \
-	else if (is_multicast_mac_addr(ra)) \
-		sec->aes_sw_enc_cnt_mc++; \
-	else \
-		sec->aes_sw_enc_cnt_uc++;
+	do { \
+		if (is_broadcast_mac_addr(ra)) \
+			sec->aes_sw_enc_cnt_bc++; \
+		else if (is_multicast_mac_addr(ra)) \
+			sec->aes_sw_enc_cnt_mc++; \
+		else \
+			sec->aes_sw_enc_cnt_uc++; \
+	} while (0)
 
 #define AES_SW_DEC_CNT_INC(sec, ra) \
-	if (is_broadcast_mac_addr(ra)) \
-		sec->aes_sw_dec_cnt_bc++; \
-	else if (is_multicast_mac_addr(ra)) \
-		sec->aes_sw_dec_cnt_mc++; \
-	else \
-		sec->aes_sw_dec_cnt_uc++;
+	do { \
+		if (is_broadcast_mac_addr(ra)) \
+			sec->aes_sw_dec_cnt_bc++; \
+		else if (is_multicast_mac_addr(ra)) \
+			sec->aes_sw_dec_cnt_mc++; \
+		else \
+			sec->aes_sw_dec_cnt_uc++; \
+	} while (0)
 #else
 #define WEP_SW_ENC_CNT_INC(sec, ra)
 #define WEP_SW_DEC_CNT_INC(sec, ra)
@@ -2080,10 +2092,12 @@ static void rijndaelEncrypt(u32 rk[/*44*/], u8 pt[16], u8 ct[16])
 	s3 = GETU32(pt + 12) ^ rk[3];
 
 #define ROUND(i, d, s) \
-d##0 = TE0(s##0) ^ TE1(s##1) ^ TE2(s##2) ^ TE3(s##3) ^ rk[4 * i]; \
-d##1 = TE0(s##1) ^ TE1(s##2) ^ TE2(s##3) ^ TE3(s##0) ^ rk[4 * i + 1]; \
-d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ rk[4 * i + 2]; \
-d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ rk[4 * i + 3]
+	do { \
+		d##0 = TE0(s##0) ^ TE1(s##1) ^ TE2(s##2) ^ TE3(s##3) ^ rk[4 * i]; \
+		d##1 = TE0(s##1) ^ TE1(s##2) ^ TE2(s##3) ^ TE3(s##0) ^ rk[4 * i + 1]; \
+		d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ rk[4 * i + 2]; \
+		d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ rk[4 * i + 3]; \
+	} while (0)
 
 	/* Nr - 1 full rounds: */
 	r = Nr >> 1;
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ