]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
staging: rtl8723bs: Fix operator spacing in rtw_security.c
authorSameeksha Sankpal <sameekshasankpal@gmail.com>
Mon, 6 Oct 2025 04:20:05 +0000 (09:50 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 13 Oct 2025 07:09:27 +0000 (09:09 +0200)
This file has multiple style issues where spaces were missing around
operators. Cleaned up the entire file by adding the required spacing
around the arithmetic, logical, and comparison operators to improve
readibility and adhere to the Linux kernel coding style guidelines.

Signed-off-by: Sameeksha Sankpal <sameekshasankpal@gmail.com>
Link: https://lore.kernel.org/r/20251006042005.9778-1-sameekshasankpal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723bs/core/rtw_security.c

index 3d99d045f4b6e6b0c4c07f68d2fdde0b2cfd0861..b2c783ada49beb9d203c375c34cf728ba81cf05d 100644 (file)
@@ -62,14 +62,14 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
                keylength = psecuritypriv->dot11DefKeylen[psecuritypriv->dot11PrivacyKeyIndex];
 
                for (curfragnum = 0; curfragnum < pattrib->nr_frags; curfragnum++) {
-                       iv = pframe+pattrib->hdrlen;
+                       iv = pframe + pattrib->hdrlen;
                        memcpy(&wepkey[0], iv, 3);
                        memcpy(&wepkey[3], &psecuritypriv->dot11DefKey[psecuritypriv->dot11PrivacyKeyIndex].skey[0], keylength);
-                       payload = pframe+pattrib->iv_len+pattrib->hdrlen;
+                       payload = pframe + pattrib->iv_len + pattrib->hdrlen;
 
-                       if ((curfragnum+1) == pattrib->nr_frags) {      /* the last fragment */
+                       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 +78,7 @@ 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);
@@ -107,16 +107,16 @@ void rtw_wep_decrypt(struct adapter  *padapter, u8 *precvframe)
 
        /* start to decrypt recvframe */
        if ((prxattrib->encrypt == _WEP40_) || (prxattrib->encrypt == _WEP104_)) {
-               iv = pframe+prxattrib->hdrlen;
+               iv = pframe + prxattrib->hdrlen;
                /* keyindex =(iv[3]&0x3); */
                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;
+               length = ((union recv_frame *)precvframe)->u.hdr.len - prxattrib->hdrlen - prxattrib->iv_len;
 
-               payload = pframe+prxattrib->iv_len+prxattrib->hdrlen;
+               payload = pframe + prxattrib->iv_len + prxattrib->hdrlen;
 
                /* decrypt payload include icv */
                arc4_setkey(ctx, wepkey, 3 + keylength);
@@ -174,7 +174,7 @@ void rtw_secmicsetkey(struct mic_data *pmicdata, u8 *key)
 void rtw_secmicappendbyte(struct mic_data *pmicdata, u8 b)
 {
        /*  Append the byte to our word-sized buffer */
-       pmicdata->M |= ((unsigned long)b) << (8*pmicdata->nBytesInM);
+       pmicdata->M |= ((unsigned long)b) << (8 * pmicdata->nBytesInM);
        pmicdata->nBytesInM++;
        /*  Process the word if it is full. */
        if (pmicdata->nBytesInM >= 4) {
@@ -261,7 +261,7 @@ void rtw_seccalctkipmic(u8 *key, u8 *header, u8 *data, u32 data_len, u8 *mic_cod
 #define  Mk16(hi, lo) ((lo) ^ (((u16)(hi)) << 8))
 
 /* select the Nth 16-bit word of the temporal key unsigned char array TK[]   */
-#define  TK16(N)     Mk16(tk[2*(N)+1], tk[2*(N)])
+#define  TK16(N)     Mk16(tk[2 * (N) + 1], tk[2 * (N)])
 
 /* S-box lookup: 16 bits --> 16 bits */
 #define _S_(v16)     (Sbox1[0][Lo8(v16)] ^ Sbox1[1][Hi8(v16)])
@@ -375,11 +375,11 @@ static void phase1(u16 *p1k, const u8 *tk, const u8 *ta, u32 iv32)
        /* size on the 80-bit block P1K[], using the 128-bit key TK[] */
        for (i = 0; i < PHASE1_LOOP_CNT; i++) {
                /* Each add operation here is mod 2**16 */
-               p1k[0] += _S_(p1k[4] ^ TK16((i&1)+0));
-               p1k[1] += _S_(p1k[0] ^ TK16((i&1)+2));
-               p1k[2] += _S_(p1k[1] ^ TK16((i&1)+4));
-               p1k[3] += _S_(p1k[2] ^ TK16((i&1)+6));
-               p1k[4] += _S_(p1k[3] ^ TK16((i&1)+0));
+               p1k[0] += _S_(p1k[4] ^ TK16((i & 1) + 0));
+               p1k[1] += _S_(p1k[0] ^ TK16((i & 1) + 2));
+               p1k[2] += _S_(p1k[1] ^ TK16((i & 1) + 4));
+               p1k[3] += _S_(p1k[2] ^ TK16((i & 1) + 6));
+               p1k[4] += _S_(p1k[3] ^ TK16((i & 1) + 0));
                p1k[4] +=  (unsigned short)i;          /* avoid "slide attacks" */
        }
 }
@@ -417,7 +417,7 @@ static void phase2(u8 *rc4key, const u8 *tk, const u16 *p1k, u16 iv16)
        for (i = 0; i < 5; i++)
                PPK[i] = p1k[i];      /* first, copy P1K to PPK      */
 
-       PPK[5]  =  p1k[4]+iv16;             /* next,  add in IV16          */
+       PPK[5]  =  p1k[4] + iv16;             /* next,  add in IV16          */
 
        /* Bijective non-linear mixing of the 96 bits of PPK[0..5]           */
        PPK[0] +=    _S_(PPK[5] ^ TK16(0));   /* Mix key in each "round"     */
@@ -448,8 +448,8 @@ static void phase2(u8 *rc4key, const u8 *tk, const u16 *p1k, u16 iv16)
 
        /* Copy 96 bits of PPK[0..5] to RC4KEY[4..15]  (little-endian)       */
        for (i = 0; i < 6; i++) {
-               rc4key[4+2*i] = Lo8(PPK[i]);
-               rc4key[5+2*i] = Hi8(PPK[i]);
+               rc4key[4 + 2 * i] = Lo8(PPK[i]);
+               rc4key[5 + 2 * i] = Hi8(PPK[i]);
        }
 }
 
@@ -492,20 +492,20 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
                                prwskey = pattrib->dot118021x_UncstKey.skey;
 
                        for (curfragnum = 0; curfragnum < pattrib->nr_frags; curfragnum++) {
-                               iv = pframe+pattrib->hdrlen;
-                               payload = pframe+pattrib->iv_len+pattrib->hdrlen;
+                               iv = pframe + pattrib->hdrlen;
+                               payload = pframe + pattrib->iv_len + pattrib->hdrlen;
 
                                GET_TKIP_PN(iv, dot11txpn);
 
                                pnl = (u16)(dot11txpn.val);
-                               pnh = (u32)(dot11txpn.val>>16);
+                               pnh = (u32)(dot11txpn.val >> 16);
 
                                phase1((u16 *)&ttkey[0], prwskey, &pattrib->ta[0], pnh);
 
                                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;
+                               if ((curfragnum + 1) == pattrib->nr_frags) {    /* 4 the last fragment */
+                                       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);
@@ -513,7 +513,7 @@ 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);
@@ -601,14 +601,14 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
                                prwskey = &stainfo->dot118021x_UncstKey.skey[0];
                        }
 
-                       iv = pframe+prxattrib->hdrlen;
-                       payload = pframe+prxattrib->iv_len+prxattrib->hdrlen;
-                       length = ((union recv_frame *)precvframe)->u.hdr.len-prxattrib->hdrlen-prxattrib->iv_len;
+                       iv = pframe + prxattrib->hdrlen;
+                       payload = pframe + prxattrib->iv_len + prxattrib->hdrlen;
+                       length = ((union recv_frame *)precvframe)->u.hdr.len - prxattrib->hdrlen - prxattrib->iv_len;
 
                        GET_TKIP_PN(iv, dot11txpn);
 
                        pnl = (u16)(dot11txpn.val);
-                       pnh = (u32)(dot11txpn.val>>16);
+                       pnh = (u32)(dot11txpn.val >> 16);
 
                        phase1((u16 *)&ttkey[0], prwskey, &prxattrib->ta[0], pnh);
                        phase2(&rc4key[0], prwskey, (unsigned short *)&ttkey[0], pnl);
@@ -758,7 +758,7 @@ static void construct_mic_header2(u8 *mic_header2,
 
                if (!qc_exists && a4_exists) {
                        for (i = 0; i < 6; i++)
-                               mic_header2[8+i] = mpdu[24+i];   /* A4 */
+                               mic_header2[8 + i] = mpdu[24 + i];   /* A4 */
                }
 
                if (qc_exists && !a4_exists) {
@@ -768,7 +768,7 @@ static void construct_mic_header2(u8 *mic_header2,
 
                if (qc_exists && a4_exists) {
                        for (i = 0; i < 6; i++)
-                               mic_header2[8+i] = mpdu[24+i];   /* A4 */
+                               mic_header2[8 + i] = mpdu[24 + i];   /* A4 */
 
                        mic_header2[14] = mpdu[30] & 0x0f;
                        mic_header2[15] = mpdu[31] & 0x00;
@@ -839,16 +839,16 @@ static signed int aes_cipher(u8 *key, uint        hdrlen,
        uint    frtype  = GetFrameType(pframe);
        uint    frsubtype  = GetFrameSubType(pframe);
 
-       frsubtype = frsubtype>>4;
+       frsubtype = frsubtype >> 4;
 
        if ((hdrlen == WLAN_HDR_A3_LEN) || (hdrlen ==  WLAN_HDR_A3_QOS_LEN))
                a4_exists = 0;
        else
                a4_exists = 1;
 
-       if (((frtype|frsubtype) == WIFI_DATA_CFACK) ||
-           ((frtype|frsubtype) == WIFI_DATA_CFPOLL) ||
-           ((frtype|frsubtype) == WIFI_DATA_CFACKPOLL)) {
+       if (((frtype | frsubtype) == WIFI_DATA_CFACK) ||
+           ((frtype | frsubtype) == WIFI_DATA_CFPOLL) ||
+           ((frtype | frsubtype) == WIFI_DATA_CFACKPOLL)) {
                qc_exists = 1;
                if (hdrlen !=  WLAN_HDR_A3_QOS_LEN)
                        hdrlen += 2;
@@ -867,11 +867,11 @@ static signed int aes_cipher(u8 *key, uint        hdrlen,
        }
 
        pn_vector[0] = pframe[hdrlen];
-       pn_vector[1] = pframe[hdrlen+1];
-       pn_vector[2] = pframe[hdrlen+4];
-       pn_vector[3] = pframe[hdrlen+5];
-       pn_vector[4] = pframe[hdrlen+6];
-       pn_vector[5] = pframe[hdrlen+7];
+       pn_vector[1] = pframe[hdrlen + 1];
+       pn_vector[2] = pframe[hdrlen + 4];
+       pn_vector[3] = pframe[hdrlen + 5];
+       pn_vector[4] = pframe[hdrlen + 6];
+       pn_vector[5] = pframe[hdrlen + 7];
 
        construct_mic_iv(mic_iv,
                         qc_exists,
@@ -927,12 +927,12 @@ static signed int aes_cipher(u8 *key, uint        hdrlen,
 
        /* Insert MIC into payload */
        for (j = 0; j < 8; j++)
-               pframe[payload_index+j] = mic[j];
+               pframe[payload_index + j] = mic[j];
 
        payload_index = hdrlen + 8;
        for (i = 0; i < num_blocks; i++) {
                construct_ctr_preload(ctr_preload, a4_exists, qc_exists, pframe, /* message, */
-                                     pn_vector, i+1, frtype);
+                                     pn_vector, i + 1, frtype);
                /*  add for CONFIG_IEEE80211W, none 11w also can use */
                aes128k128d(key, ctr_preload, aes_out);
                crypto_xor_cpy(chain_buffer, aes_out, &pframe[payload_index], 16);
@@ -944,13 +944,13 @@ static signed int aes_cipher(u8 *key, uint        hdrlen,
                /* If there is a short final block, then pad it,*/
                /* encrypt it and copy the unpadded part back   */
                construct_ctr_preload(ctr_preload, a4_exists, qc_exists, pframe, /* message, */
-                                     pn_vector, num_blocks+1, frtype);
+                                     pn_vector, num_blocks + 1, frtype);
                /*  add for CONFIG_IEEE80211W, none 11w also can use */
 
                for (j = 0; j < 16; j++)
                        padded_buffer[j] = 0x00;
                for (j = 0; j < payload_remainder; j++)
-                       padded_buffer[j] = pframe[payload_index+j];
+                       padded_buffer[j] = pframe[payload_index + j];
 
                aes128k128d(key, ctr_preload, aes_out);
                crypto_xor_cpy(chain_buffer, aes_out, padded_buffer, 16);
@@ -966,7 +966,7 @@ static signed int aes_cipher(u8 *key, uint  hdrlen,
        for (j = 0; j < 16; j++)
                padded_buffer[j] = 0x00;
        for (j = 0; j < 8; j++)
-               padded_buffer[j] = pframe[j+hdrlen+8+plen];
+               padded_buffer[j] = pframe[j + hdrlen + 8 + plen];
 
        aes128k128d(key, ctr_preload, aes_out);
        crypto_xor_cpy(chain_buffer, aes_out, padded_buffer, 16);
@@ -1006,12 +1006,12 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
                        prwskey = pattrib->dot118021x_UncstKey.skey;
 
                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;
+                       if ((curfragnum + 1) == pattrib->nr_frags) {    /* 4 the last fragment */
+                               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;
@@ -1044,13 +1044,13 @@ static signed int aes_decipher(u8 *key, uint    hdrlen,
        uint frtype  = GetFrameType(pframe);
        uint frsubtype  = GetFrameSubType(pframe);
 
-       frsubtype = frsubtype>>4;
+       frsubtype = frsubtype >> 4;
 
        /* start to decrypt the payload */
 
-       num_blocks = (plen-8) / 16; /* plen including LLC, payload_length and mic) */
+       num_blocks = (plen - 8) / 16; /* plen including LLC, payload_length and mic) */
 
-       payload_remainder = (plen-8) % 16;
+       payload_remainder = (plen - 8) % 16;
 
        pn_vector[0]  = pframe[hdrlen];
        pn_vector[1]  = pframe[hdrlen + 1];
@@ -1064,9 +1064,9 @@ static signed int aes_decipher(u8 *key, uint      hdrlen,
        else
                a4_exists = 1;
 
-       if (((frtype|frsubtype) == WIFI_DATA_CFACK) ||
-           ((frtype|frsubtype) == WIFI_DATA_CFPOLL) ||
-           ((frtype|frsubtype) == WIFI_DATA_CFACKPOLL)) {
+       if (((frtype | frsubtype) == WIFI_DATA_CFACK) ||
+           ((frtype | frsubtype) == WIFI_DATA_CFPOLL) ||
+           ((frtype | frsubtype) == WIFI_DATA_CFACKPOLL)) {
                qc_exists = 1;
                if (hdrlen !=  WLAN_HDR_A3_QOS_LEN)
                        hdrlen += 2;
@@ -1105,13 +1105,13 @@ static signed int aes_decipher(u8 *key, uint    hdrlen,
                /* If there is a short final block, then pad it,*/
                /* encrypt it and copy the unpadded part back   */
                construct_ctr_preload(ctr_preload, a4_exists, qc_exists, pframe, pn_vector,
-                                     num_blocks+1, frtype);
+                                     num_blocks + 1, frtype);
                /*  add for CONFIG_IEEE80211W, none 11w also can use */
 
                for (j = 0; j < 16; j++)
                        padded_buffer[j] = 0x00;
                for (j = 0; j < payload_remainder; j++)
-                       padded_buffer[j] = pframe[payload_index+j];
+                       padded_buffer[j] = pframe[payload_index + j];
 
                aes128k128d(key, ctr_preload, aes_out);
                crypto_xor_cpy(chain_buffer, aes_out, padded_buffer, 16);
@@ -1120,25 +1120,25 @@ static signed int aes_decipher(u8 *key, uint    hdrlen,
        }
 
        /* start to calculate the mic */
-       if ((hdrlen + plen+8) <= MAX_MSG_SIZE)
-               memcpy((void *)message, pframe, (hdrlen + plen+8)); /* 8 is for ext iv len */
+       if ((hdrlen + plen + 8) <= MAX_MSG_SIZE)
+               memcpy((void *)message, pframe, (hdrlen + plen + 8)); /* 8 is for ext iv len */
 
        pn_vector[0] = pframe[hdrlen];
-       pn_vector[1] = pframe[hdrlen+1];
-       pn_vector[2] = pframe[hdrlen+4];
-       pn_vector[3] = pframe[hdrlen+5];
-       pn_vector[4] = pframe[hdrlen+6];
-       pn_vector[5] = pframe[hdrlen+7];
+       pn_vector[1] = pframe[hdrlen + 1];
+       pn_vector[2] = pframe[hdrlen + 4];
+       pn_vector[3] = pframe[hdrlen + 5];
+       pn_vector[4] = pframe[hdrlen + 6];
+       pn_vector[5] = pframe[hdrlen + 7];
 
-       construct_mic_iv(mic_iv, qc_exists, a4_exists, message, plen-8, pn_vector, frtype);
+       construct_mic_iv(mic_iv, qc_exists, a4_exists, message, plen - 8, pn_vector, frtype);
        /*  add for CONFIG_IEEE80211W, none 11w also can use */
 
        construct_mic_header1(mic_header1, hdrlen, message, frtype);
        /*  add for CONFIG_IEEE80211W, none 11w also can use */
        construct_mic_header2(mic_header2, message, a4_exists, qc_exists);
 
-       payload_remainder = (plen-8) % 16;
-       num_blocks = (plen-8) / 16;
+       payload_remainder = (plen - 8) % 16;
+       num_blocks = (plen - 8) / 16;
 
        /* Find start of payload */
        payload_index = (hdrlen + 8);
@@ -1173,11 +1173,11 @@ static signed int aes_decipher(u8 *key, uint    hdrlen,
 
        /* Insert MIC into payload */
        for (j = 0; j < 8; j++)
-               message[payload_index+j] = mic[j];
+               message[payload_index + j] = mic[j];
 
        payload_index = hdrlen + 8;
        for (i = 0; i < num_blocks; i++) {
-               construct_ctr_preload(ctr_preload, a4_exists, qc_exists, message, pn_vector, i+1,
+               construct_ctr_preload(ctr_preload, a4_exists, qc_exists, message, pn_vector, i + 1,
                                      frtype);
                /*  add for CONFIG_IEEE80211W, none 11w also can use */
                aes128k128d(key, ctr_preload, aes_out);
@@ -1190,13 +1190,13 @@ static signed int aes_decipher(u8 *key, uint    hdrlen,
                /* If there is a short final block, then pad it,*/
                /* encrypt it and copy the unpadded part back   */
                construct_ctr_preload(ctr_preload, a4_exists, qc_exists, message, pn_vector,
-                                     num_blocks+1, frtype);
+                                     num_blocks + 1, frtype);
                /*  add for CONFIG_IEEE80211W, none 11w also can use */
 
                for (j = 0; j < 16; j++)
                        padded_buffer[j] = 0x00;
                for (j = 0; j < payload_remainder; j++)
-                       padded_buffer[j] = message[payload_index+j];
+                       padded_buffer[j] = message[payload_index + j];
 
                aes128k128d(key, ctr_preload, aes_out);
                crypto_xor_cpy(chain_buffer, aes_out, padded_buffer, 16);
@@ -1211,7 +1211,7 @@ static signed int aes_decipher(u8 *key, uint      hdrlen,
        for (j = 0; j < 16; j++)
                padded_buffer[j] = 0x00;
        for (j = 0; j < 8; j++)
-               padded_buffer[j] = message[j+hdrlen+8+plen-8];
+               padded_buffer[j] = message[j + hdrlen + 8 + plen - 8];
 
        aes128k128d(key, ctr_preload, aes_out);
        crypto_xor_cpy(chain_buffer, aes_out, padded_buffer, 16);
@@ -1298,7 +1298,7 @@ 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);
 
@@ -1323,7 +1323,7 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
        __le16 le_tmp;
        __le64 le_tmp64;
 
-       ori_len = pattrib->pkt_len-WLAN_HDR_A3_LEN+BIP_AAD_SIZE;
+       ori_len = pattrib->pkt_len - WLAN_HDR_A3_LEN + BIP_AAD_SIZE;
        BIP_AAD = rtw_zmalloc(ori_len);
 
        if (!BIP_AAD)
@@ -1334,28 +1334,28 @@ 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;
                u64 temp_ipn = 0;
                /* save packet number */
-               memcpy(&le_tmp64, p+4, 6);
+               memcpy(&le_tmp64, p + 4, 6);
                temp_ipn = le64_to_cpu(le_tmp64);
                /* BIP packet number should bigger than previous BIP packet */
                if (temp_ipn <= pmlmeext->mgnt_80211w_IPN_rx)
                        goto BIP_exit;
 
                /* copy key index */
-               memcpy(&le_tmp, p+2, 2);
+               memcpy(&le_tmp, p + 2, 2);
                keyid = le16_to_cpu(le_tmp);
                if (keyid != padapter->securitypriv.dot11wBIPKeyid)
                        goto BIP_exit;
 
                /* clear the MIC field of MME to zero */
-               memset(p+2+len-8, 0, 8);
+               memset(p + 2 + len - 8, 0, 8);
 
                /* conscruct AAD, copy frame control field */
                memcpy(BIP_AAD, &pwlanhdr->frame_control, 2);
@@ -1515,7 +1515,7 @@ u8 rtw_handle_tkip_countermeasure(struct adapter *adapter, const char *caller)
        if (securitypriv->btkip_countermeasure) {
                unsigned long passing_ms = jiffies_to_msecs(jiffies - securitypriv->btkip_countermeasure_time);
 
-               if (passing_ms > 60*1000) {
+               if (passing_ms > 60 * 1000) {
                        netdev_dbg(adapter->pnetdev,
                                   "%s(%s) countermeasure time:%lus > 60s\n",
                                   caller, ADPT_ARG(adapter),