From 6dcb1b00ca579a22b36141a7f76b64e9835a5f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Gawro=C5=84ski?= Date: Wed, 22 Jul 2026 23:53:25 +0200 Subject: [PATCH] staging: rtl8723bs: Replace custom RotR1 macro with ror16 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The custom RotR1 macro reuses its argument, which throws a checkpatch warning and can lead to unexpected side-effects if called with an expression that has side-effects. Remove the custom macro and replace its usages with the standard kernel ror16() function from to clean up the code. Signed-off-by: Patryk GawroĊ„ski Link: https://patch.msgid.link/20260722215327.62791-1-gawronski1.6@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/core/rtw_security.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c index 29e2a5a771dd..2217cffac5f2 100644 --- a/drivers/staging/rtl8723bs/core/rtw_security.c +++ b/drivers/staging/rtl8723bs/core/rtw_security.c @@ -6,6 +6,7 @@ ******************************************************************************/ #include #include +#include #include #include #include @@ -225,7 +226,6 @@ void rtw_seccalctkipmic(u8 *key, u8 *header, u8 *data, u32 data_len, u8 *mic_cod } /* macros for extraction/creation of unsigned char/unsigned short values */ -#define RotR1(v16) ((((v16) >> 1) & 0x7FFF) ^ (((v16) & 1) << 15)) #define Lo8(v16) ((u8)((v16) & 0x00FF)) #define Hi8(v16) ((u8)(((v16) >> 8) & 0x00FF)) #define Lo16(v32) ((u16)((v32) & 0xFFFF)) @@ -392,12 +392,12 @@ static void phase2(u8 *rc4key, const u8 *tk, const u16 *p1k, u16 iv16) PPK[5] += _S_(PPK[4] ^ TK16(5)); /* Total # S-box lookups == 6 */ /* Final sweep: bijective, "linear". Rotates kill LSB correlations */ - PPK[0] += RotR1(PPK[5] ^ TK16(6)); - PPK[1] += RotR1(PPK[0] ^ TK16(7)); /* Use all of TK[] in Phase2 */ - PPK[2] += RotR1(PPK[1]); - PPK[3] += RotR1(PPK[2]); - PPK[4] += RotR1(PPK[3]); - PPK[5] += RotR1(PPK[4]); + PPK[0] += ror16(PPK[5] ^ TK16(6), 1); + PPK[1] += ror16(PPK[0] ^ TK16(7), 1); /* Use all of TK[] in Phase2 */ + PPK[2] += ror16(PPK[1], 1); + PPK[3] += ror16(PPK[2], 1); + PPK[4] += ror16(PPK[3], 1); + PPK[5] += ror16(PPK[4], 1); /* Note: At this point, for a given key TK[0..15], the 96-bit output */ /* value PPK[0..5] is guaranteed to be unique, as a function */ /* of the 96-bit "input" value {TA, IV32, IV16}. That is, P1K */