* [PATCH] staging: rtl8723bs: fix lines exceeding 100 columns in rtw_security.c
@ 2026-09-14 14:52 Rareș-Mihai Vladu
2026-09-15 1:44 ` kernel test robot
0 siblings, 1 reply; 2+ messages in thread
From: Rareș-Mihai Vladu @ 2026-09-14 14:52 UTC (permalink / raw)
To: gregkh; +Cc: linux-staging, linux-kernel, Rareș-Mihai Vladu
Reformat long lines in rtw_security.c to fit within the 100-column
limit by splitting function arguments, expressions, and moving
Signed-off-by: Rareș-Mihai Vladu <vladurares@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_security.c | 94 +++++++++++++------
1 file changed, 66 insertions(+), 28 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index 2217cffac..208aa0f31 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -34,7 +34,8 @@ const char *security_type_str(u8 value)
/* Need to consider the fragment situation */
void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
-{ /* exclude ICV */
+{
+ /* exclude ICV */
union {
__le32 f0;
unsigned char f1[4];
@@ -64,12 +65,17 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
for (curfragnum = 0; curfragnum < pattrib->nr_frags; curfragnum++) {
iv = pframe + pattrib->hdrlen;
memcpy(&wepkey[0], iv, 3);
- memcpy(&wepkey[3], &psecuritypriv->dot11DefKey[psecuritypriv->dot11PrivacyKeyIndex].skey[0], keylength);
+ int idx = psecuritypriv->dot11PrivacyKeyIndex;
+
+ memcpy(&wepkey[3],
+ &psecuritypriv->dot11DefKey[idx].skey[0],
+ keylength);
payload = pframe + pattrib->iv_len + pattrib->hdrlen;
if ((curfragnum + 1) == pattrib->nr_frags) { /* the last fragment */
- length = pattrib->last_txcmdsz - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len;
+ length = pattrib->last_txcmdsz - pattrib->hdrlen -
+ pattrib->iv_len - pattrib->icv_len;
crc.f0 = cpu_to_le32(~crc32_le(~0, payload, length));
@@ -78,7 +84,8 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
arc4_crypt(ctx, payload + length, crc.f1, 4);
} else {
- length = pxmitpriv->frag_len - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len;
+ length = pxmitpriv->frag_len - pattrib->hdrlen -
+ pattrib->iv_len - pattrib->icv_len;
crc.f0 = cpu_to_le32(~crc32_le(~0, payload, length));
arc4_setkey(ctx, wepkey, 3 + keylength);
arc4_crypt(ctx, payload, payload, length);
@@ -112,9 +119,16 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)
keyindex = prxattrib->key_index;
keylength = psecuritypriv->dot11DefKeylen[keyindex];
memcpy(&wepkey[0], iv, 3);
- /* memcpy(&wepkey[3], &psecuritypriv->dot11DefKey[psecuritypriv->dot11PrivacyKeyIndex].skey[0], keylength); */
- memcpy(&wepkey[3], &psecuritypriv->dot11DefKey[keyindex].skey[0], keylength);
- length = ((union recv_frame *)precvframe)->u.hdr.len - prxattrib->hdrlen - prxattrib->iv_len;
+ /*
+ * memcpy(&wepkey[3],
+ * &psecuritypriv->dot11DefKey[psecuritypriv->dot11PrivacyKeyIndex].skey[0],
+ * keylength);
+ */
+ memcpy(&wepkey[3],
+ &psecuritypriv->dot11DefKey[keyindex].skey[0],
+ keylength);
+ length = ((union recv_frame *)precvframe)->u.hdr.len -
+ prxattrib->hdrlen - prxattrib->iv_len;
payload = pframe + prxattrib->iv_len + prxattrib->hdrlen;
@@ -157,7 +171,8 @@ void rtw_secmicappendbyte(struct mic_data *pmicdata, u8 b)
pmicdata->L ^= pmicdata->M;
pmicdata->R ^= ROL32(pmicdata->L, 17);
pmicdata->L += pmicdata->R;
- pmicdata->R ^= ((pmicdata->L & 0xff00ff00) >> 8) | ((pmicdata->L & 0x00ff00ff) << 8);
+ pmicdata->R ^= ((pmicdata->L & 0xff00ff00) >> 8) |
+ ((pmicdata->L & 0x00ff00ff) << 8);
pmicdata->L += pmicdata->R;
pmicdata->R ^= ROL32(pmicdata->L, 3);
pmicdata->L += pmicdata->R;
@@ -418,7 +433,8 @@ static void phase2(u8 *rc4key, const u8 *tk, const u16 *p1k, u16 iv16)
/* The hlen isn't include the IV */
u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
-{ /* exclude ICV */
+{
+ /* exclude ICV */
u16 pnl;
u32 pnh;
u8 rc4key[16];
@@ -467,7 +483,8 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
phase2(&rc4key[0], prwskey, (u16 *)&ttkey[0], pnl);
if ((curfragnum + 1) == pattrib->nr_frags) { /* 4 the last fragment */
- length = pattrib->last_txcmdsz - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len;
+ length = pattrib->last_txcmdsz - pattrib->hdrlen -
+ pattrib->iv_len - pattrib->icv_len;
crc.f0 = cpu_to_le32(~crc32_le(~0, payload, length));
arc4_setkey(ctx, rc4key, 16);
@@ -475,7 +492,8 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
arc4_crypt(ctx, payload + length, crc.f1, 4);
} else {
- length = pxmitpriv->frag_len - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len;
+ length = pxmitpriv->frag_len - pattrib->hdrlen -
+ pattrib->iv_len - pattrib->icv_len;
crc.f0 = cpu_to_le32(~crc32_le(~0, payload, length));
arc4_setkey(ctx, rc4key, 16);
@@ -491,7 +509,8 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
/* The hlen isn't include the IV */
u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
-{ /* exclude ICV */
+{
+ /* exclude ICV */
u16 pnl;
u32 pnh;
u8 rc4key[16];
@@ -536,7 +555,8 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
if (jiffies_to_msecs(jiffies - start) > 1000) {
if (no_gkey_bc_cnt || no_gkey_mc_cnt) {
netdev_dbg(padapter->pnetdev,
- FUNC_ADPT_FMT " no_gkey_bc_cnt:%u, no_gkey_mc_cnt:%u\n",
+ FUNC_ADPT_FMT
+ " no_gkey_bc_cnt:%u, no_gkey_mc_cnt:%u\n",
FUNC_ADPT_ARG(padapter),
no_gkey_bc_cnt,
no_gkey_mc_cnt);
@@ -550,7 +570,8 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
if (no_gkey_bc_cnt || no_gkey_mc_cnt) {
netdev_dbg(padapter->pnetdev,
- FUNC_ADPT_FMT " gkey installed. no_gkey_bc_cnt:%u, no_gkey_mc_cnt:%u\n",
+ FUNC_ADPT_FMT
+ " gkey installed. no_gkey_bc_cnt:%u, no_gkey_mc_cnt:%u\n",
FUNC_ADPT_ARG(padapter),
no_gkey_bc_cnt,
no_gkey_mc_cnt);
@@ -566,7 +587,8 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
iv = pframe + prxattrib->hdrlen;
payload = pframe + prxattrib->iv_len + prxattrib->hdrlen;
- length = ((union recv_frame *)precvframe)->u.hdr.len - prxattrib->hdrlen - prxattrib->iv_len;
+ length = ((union recv_frame *)precvframe)->u.hdr.len -
+ prxattrib->hdrlen - prxattrib->iv_len;
GET_TKIP_PN(iv, dot11txpn);
@@ -757,10 +779,12 @@ static void construct_ctr_preload(u8 *ctr_preload,
if (frtype == WIFI_MGT_TYPE)
ctr_preload[1] |= BIT(4);
+ /* ctr_preload[2:7] = A2[0:5] = mpdu[10:15] */
for (i = 2; i < 8; i++)
- ctr_preload[i] = mpdu[i + 8]; /* ctr_preload[2:7] = A2[0:5] = mpdu[10:15] */
+ ctr_preload[i] = mpdu[i + 8];
+ /* ctr_preload[8:13] = PN[5:0] */
for (i = 8; i < 14; i++)
- ctr_preload[i] = pn_vector[13 - i]; /* ctr_preload[8:13] = PN[5:0] */
+ ctr_preload[i] = pn_vector[13 - i];
ctr_preload[14] = (unsigned char)(c / 256); /* Ctr */
ctr_preload[15] = (unsigned char)(c % 256);
}
@@ -952,11 +976,13 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
for (curfragnum = 0; curfragnum < pattrib->nr_frags; curfragnum++) {
if ((curfragnum + 1) == pattrib->nr_frags) { /* 4 the last fragment */
- length = pattrib->last_txcmdsz - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len;
+ length = pattrib->last_txcmdsz - pattrib->hdrlen -
+ pattrib->iv_len - pattrib->icv_len;
aes_cipher(prwskey, pattrib->hdrlen, pframe, length);
} else {
- length = pxmitpriv->frag_len - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len;
+ length = pxmitpriv->frag_len - pattrib->hdrlen -
+ pattrib->iv_len - pattrib->icv_len;
aes_cipher(prwskey, pattrib->hdrlen, pframe, length);
pframe += pxmitpriv->frag_len;
@@ -1205,7 +1231,8 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
if (jiffies_to_msecs(jiffies - start) > 1000) {
if (no_gkey_bc_cnt || no_gkey_mc_cnt) {
netdev_dbg(padapter->pnetdev,
- FUNC_ADPT_FMT " no_gkey_bc_cnt:%u, no_gkey_mc_cnt:%u\n",
+ FUNC_ADPT_FMT
+ " no_gkey_bc_cnt:%u, no_gkey_mc_cnt:%u\n",
FUNC_ADPT_ARG(padapter),
no_gkey_bc_cnt,
no_gkey_mc_cnt);
@@ -1220,7 +1247,8 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
if (no_gkey_bc_cnt || no_gkey_mc_cnt) {
netdev_dbg(padapter->pnetdev,
- FUNC_ADPT_FMT " gkey installed. no_gkey_bc_cnt:%u, no_gkey_mc_cnt:%u\n",
+ FUNC_ADPT_FMT
+ " gkey installed. no_gkey_bc_cnt:%u, no_gkey_mc_cnt:%u\n",
FUNC_ADPT_ARG(padapter),
no_gkey_bc_cnt,
no_gkey_mc_cnt);
@@ -1238,7 +1266,8 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
prwskey = &stainfo->dot118021x_UncstKey.skey[0];
}
- length = ((union recv_frame *)precvframe)->u.hdr.len - prxattrib->hdrlen - prxattrib->iv_len;
+ length = ((union recv_frame *)precvframe)->u.hdr.len -
+ prxattrib->hdrlen - prxattrib->iv_len;
res = aes_decipher(prwskey, prxattrib->hdrlen, pframe, length);
@@ -1269,9 +1298,14 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
/* mapping to wlan header */
pwlanhdr = (struct ieee80211_hdr *)pframe;
/* save the frame body + MME */
- memcpy(BIP_AAD + BIP_AAD_SIZE, pframe + WLAN_HDR_A3_LEN, pattrib->pkt_len - WLAN_HDR_A3_LEN);
+ memcpy(BIP_AAD + BIP_AAD_SIZE,
+ pframe + WLAN_HDR_A3_LEN,
+ pattrib->pkt_len - WLAN_HDR_A3_LEN);
/* find MME IE pointer */
- p = rtw_get_ie(BIP_AAD + BIP_AAD_SIZE, WLAN_EID_MMIE, &len, pattrib->pkt_len - WLAN_HDR_A3_LEN);
+ p = rtw_get_ie(BIP_AAD + BIP_AAD_SIZE,
+ WLAN_EID_MMIE,
+ &len,
+ pattrib->pkt_len - WLAN_HDR_A3_LEN);
/* Baron */
if (p) {
u16 keyid = 0;
@@ -1300,8 +1334,10 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
/* conscruct AAD, copy address 1 to address 3 */
memcpy(BIP_AAD + 2, &pwlanhdr->addrs, sizeof(pwlanhdr->addrs));
- if (omac1_aes_128(padapter->securitypriv.dot11wBIPKey[padapter->securitypriv.dot11wBIPKeyid].skey
- , BIP_AAD, ori_len, mic))
+ int keyid = padapter->securitypriv.dot11wBIPKeyid;
+ u8 *bip_key = padapter->securitypriv.dot11wBIPKey[keyid].skey;
+
+ if (omac1_aes_128(bip_key, BIP_AAD, ori_len, mic))
goto BIP_exit;
/* MIC field should be last 8 bytes of packet (packet without FCS) */
@@ -1430,7 +1466,8 @@ void rtw_sec_restore_wep_key(struct adapter *adapter)
struct security_priv *securitypriv = &adapter->securitypriv;
signed int keyid;
- if ((securitypriv->dot11_privacy_algrthm == _WEP40_) || (securitypriv->dot11_privacy_algrthm == _WEP104_)) {
+ if ((securitypriv->dot11_privacy_algrthm == _WEP40_) ||
+ (securitypriv->dot11_privacy_algrthm == _WEP104_)) {
for (keyid = 0; keyid < 4; keyid++) {
if (securitypriv->key_mask & BIT(keyid)) {
if (keyid == securitypriv->dot11PrivacyKeyIndex)
@@ -1448,7 +1485,8 @@ u8 rtw_handle_tkip_countermeasure(struct adapter *adapter, const char *caller)
u8 status = _SUCCESS;
if (securitypriv->btkip_countermeasure) {
- unsigned long passing_ms = jiffies_to_msecs(jiffies - securitypriv->btkip_countermeasure_time);
+ unsigned long elapsed = jiffies - securitypriv->btkip_countermeasure_time;
+ unsigned long passing_ms = jiffies_to_msecs(elapsed);
if (passing_ms > 60 * 1000) {
netdev_dbg(adapter->pnetdev,
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] staging: rtl8723bs: fix lines exceeding 100 columns in rtw_security.c
2026-09-14 14:52 [PATCH] staging: rtl8723bs: fix lines exceeding 100 columns in rtw_security.c Rareș-Mihai Vladu
@ 2026-09-15 1:44 ` kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-09-15 1:44 UTC (permalink / raw)
To: Rareș-Mihai Vladu, gregkh
Cc: llvm, oe-kbuild-all, linux-staging, linux-kernel, Rareș-Mihai Vladu
Hi Rareș-Mihai,
kernel test robot noticed the following build errors:
[auto build test ERROR on staging/staging-testing]
url: https://github.com/intel-lab-lkp/linux/commits/Rare-Mihai-Vladu/staging-rtl8723bs-fix-lines-exceeding-100-columns-in-rtw_security-c/20260914-145256
base: staging/staging-testing
patch link: https://lore.kernel.org/r/20260914145256.996968-1-vladurares%40gmail.com
patch subject: [PATCH] staging: rtl8723bs: fix lines exceeding 100 columns in rtw_security.c
config: hexagon-randconfig-002-20260915 (https://download.01.org/0day-ci/archive/20260915/202609150940.PBljt2rP-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 148ee2b266b73a49f1f31d0bd17d4818b91bee9f)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260915/202609150940.PBljt2rP-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202609150940.PBljt2rP-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/staging/rtl8723bs/core/rtw_security.c:1337:7: error: redefinition of 'keyid' with a different type: 'int' vs 'u16' (aka 'unsigned short')
1337 | int keyid = padapter->securitypriv.dot11wBIPKeyid;
| ^
drivers/staging/rtl8723bs/core/rtw_security.c:1311:7: note: previous definition is here
1311 | u16 keyid = 0;
| ^
1 error generated.
vim +1337 drivers/staging/rtl8723bs/core/rtw_security.c
1277
1278 u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
1279 {
1280 struct rx_pkt_attrib *pattrib = &((union recv_frame *)precvframe)->u.hdr.attrib;
1281 u8 *pframe;
1282 u8 *BIP_AAD, *p;
1283 u32 res = _FAIL;
1284 uint len, ori_len;
1285 struct ieee80211_hdr *pwlanhdr;
1286 u8 mic[16];
1287 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
1288 __le16 le_tmp;
1289 __le64 le_tmp64 = 0;
1290
1291 ori_len = pattrib->pkt_len - WLAN_HDR_A3_LEN + BIP_AAD_SIZE;
1292 BIP_AAD = kzalloc(ori_len, GFP_KERNEL);
1293 if (!BIP_AAD)
1294 return _FAIL;
1295
1296 /* PKT start */
1297 pframe = (unsigned char *)((union recv_frame *)precvframe)->u.hdr.rx_data;
1298 /* mapping to wlan header */
1299 pwlanhdr = (struct ieee80211_hdr *)pframe;
1300 /* save the frame body + MME */
1301 memcpy(BIP_AAD + BIP_AAD_SIZE,
1302 pframe + WLAN_HDR_A3_LEN,
1303 pattrib->pkt_len - WLAN_HDR_A3_LEN);
1304 /* find MME IE pointer */
1305 p = rtw_get_ie(BIP_AAD + BIP_AAD_SIZE,
1306 WLAN_EID_MMIE,
1307 &len,
1308 pattrib->pkt_len - WLAN_HDR_A3_LEN);
1309 /* Baron */
1310 if (p) {
1311 u16 keyid = 0;
1312 u64 temp_ipn = 0;
1313 /* save packet number */
1314 memcpy(&le_tmp64, p + 4, 6);
1315 temp_ipn = le64_to_cpu(le_tmp64);
1316 /* BIP packet number should bigger than previous BIP packet */
1317 if (temp_ipn <= pmlmeext->mgnt_80211w_IPN_rx)
1318 goto BIP_exit;
1319
1320 /* copy key index */
1321 memcpy(&le_tmp, p + 2, 2);
1322 keyid = le16_to_cpu(le_tmp);
1323 if (keyid != padapter->securitypriv.dot11wBIPKeyid)
1324 goto BIP_exit;
1325
1326 /* clear the MIC field of MME to zero */
1327 memset(p + 2 + len - 8, 0, 8);
1328
1329 /* conscruct AAD, copy frame control field */
1330 memcpy(BIP_AAD, &pwlanhdr->frame_control, 2);
1331 ClearRetry(BIP_AAD);
1332 ClearPwrMgt(BIP_AAD);
1333 ClearMData(BIP_AAD);
1334 /* conscruct AAD, copy address 1 to address 3 */
1335 memcpy(BIP_AAD + 2, &pwlanhdr->addrs, sizeof(pwlanhdr->addrs));
1336
> 1337 int keyid = padapter->securitypriv.dot11wBIPKeyid;
1338 u8 *bip_key = padapter->securitypriv.dot11wBIPKey[keyid].skey;
1339
1340 if (omac1_aes_128(bip_key, BIP_AAD, ori_len, mic))
1341 goto BIP_exit;
1342
1343 /* MIC field should be last 8 bytes of packet (packet without FCS) */
1344 if (!memcmp(mic, pframe + pattrib->pkt_len - 8, 8)) {
1345 pmlmeext->mgnt_80211w_IPN_rx = temp_ipn;
1346 res = _SUCCESS;
1347 } else {
1348 }
1349
1350 } else {
1351 res = RTW_RX_HANDLED;
1352 }
1353 BIP_exit:
1354
1355 kfree(BIP_AAD);
1356 return res;
1357 }
1358
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-15 1:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-14 14:52 [PATCH] staging: rtl8723bs: fix lines exceeding 100 columns in rtw_security.c Rareș-Mihai Vladu
2026-09-15 1:44 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®