Staging: rtl8192u: ieee80211: checkpatch cleanups
cover Staging: rtl8192u: ieee80211: checkpatch cleanups
This patch series corrects most checkpatch.pl errors and some warnings in the ieee80211_crypt_tkip.c file.
Kurt Kanzenbach (8):
Staging: rtl8192u: ieee80211: fixed open brace positions
Staging: rtl8192u: ieee80211: fixed position of else statements
Staging: rtl8192u: ieee80211: added missing space around '='
Staging: rtl8192u: ieee80211: added missing spaces after if
Staging: rtl8192u: ieee80211: corrected indent
Staging: rtl8192u: ieee80211: corrected block comments
Staging: rtl8192u: ieee80211: removed unnecessary braces
Staging: rtl8192u: ieee80211: added missing blank lines
.../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 76 ++++++++++++---------- 1 file changed, 41 insertions(+), 35 deletions(-)
Signature · 1 line
2.4.10
PATCH 1/8 Staging: rtl8192u: ieee80211: fixed open brace positions
This patch fixes the following checkpatch error:
- ERROR: that open brace { should be on the previous line
--- .../staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +6 -12
@@ -185,8 +185,7 @@ static inline u16 Mk16_le(u16 *v) } -static const u16 Sbox[256 ] = -{ +static const u16 Sbox[256 ] = {0xC6A5 ,0xF884 ,0xEE99 ,0xF68D ,0xFF0D ,0xD6BD ,0xDEB1 ,0x9154 ,0x6050 ,0x0203 ,0xCEA9 ,0x567D ,0xE719 ,0xB562 ,0x4DE6 ,0xEC9A ,0x8F45 ,0x1F9D ,0x8940 ,0xFA87 ,0xEF15 ,0xB2EB ,0x8EC9 ,0xFB0B ,
@@ -320,8 +319,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) hdr = (struct rtl_80211_hdr_4addr *) skb->data; -if (!tcb_desc->bHwSec) - { +if (!tcb_desc->bHwSec) {if (!tkey->tx_phase1_done) {tkip_mixing_phase1 (tkey->tx_ttak, tkey->key, hdr->addr2, tkey->tx_iv32);
@@ -338,14 +336,12 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)memmove (pos, pos +8 , hdr_len); pos += hdr_len; -if (tcb_desc->bHwSec) - { +if (tcb_desc->bHwSec) { *pos++ =Hi8 (tkey->tx_iv16); *pos++ = (Hi8 (tkey->tx_iv16) |0x20 ) &0x7F ; *pos++ =Lo8 (tkey->tx_iv16); } -else - { +else { *pos++ = rc4key[0 ]; *pos++ = rc4key[1 ]; *pos++ = rc4key[2 ];
@@ -357,8 +353,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) *pos++ = (tkey->tx_iv32 >>16 ) &0xff ; *pos++ = (tkey->tx_iv32 >>24 ) &0xff ; -if (!tcb_desc->bHwSec) - { +if (!tcb_desc->bHwSec) { icv =skb_put (skb,4 ); crc = ~crc32_le (~0 , pos, len); icv[0 ] = crc;
@@ -429,8 +424,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) iv32 = pos[4 ] | (pos[5 ] <<8 ) | (pos[6 ] <<16 ) | (pos[7 ] <<24 ); pos +=8 ; -if (!tcb_desc->bHwSec) - { +if (!tcb_desc->bHwSec) {if (iv32 < tkey->rx_iv32 || (iv32 == tkey->rx_iv32 && iv16 <= tkey->rx_iv16)) {if (net_ratelimit ()) {
Signature · 1 line
2.4.10
PATCH 2/8 Staging: rtl8192u: ieee80211: fixed position of else statements
In reply to Kurt KanzenbachThis patch fixes the following checkpatch error:
- ERROR: else should follow close brace '}'
--- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +2 -4
@@ -326,8 +326,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) tkey->tx_phase1_done =1 ; }tkip_mixing_phase2 (rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16); - } -else + }else tkey->tx_phase1_done =1 ;
@@ -340,8 +339,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) *pos++ =Hi8 (tkey->tx_iv16); *pos++ = (Hi8 (tkey->tx_iv16) |0x20 ) &0x7F ; *pos++ =Lo8 (tkey->tx_iv16); - } -else { + }else { *pos++ = rc4key[0 ]; *pos++ = rc4key[1 ]; *pos++ = rc4key[2 ];
Signature · 1 line
2.4.10
PATCH 3/8 Staging: rtl8192u: ieee80211: added missing space around '='
In reply to Kurt KanzenbachThis patch fixes the following checkpatch error:
- ERROR: spaces required around that '='
--- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +1 -1
@@ -360,7 +360,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) icv[3 ] = crc >>24 ;crypto_blkcipher_setkey (tkey->tx_tfm_arc4, rc4key,16 );sg_init_one (&sg, pos, len+4 ); - ret=crypto_blkcipher_encrypt (&desc, &sg, &sg, len +4 ); + ret =crypto_blkcipher_encrypt (&desc, &sg, &sg, len +4 ); } tkey->tx_iv16++;
Signature · 1 line
2.4.10
PATCH 4/8 Staging: rtl8192u: ieee80211: added missing spaces after if
In reply to Kurt KanzenbachThis patch fixes the following checkpatch error:
- ERROR: space required before the open parenthesis '('
--- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +2 -2
@@ -563,7 +563,7 @@ static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *pri// { david, 2006.9.1 // fix the wpa process with wmm enabled. -if (IEEE80211_QOS_HAS_SEQ (le16_to_cpu (hdr->frame_ctl))) { +if (IEEE80211_QOS_HAS_SEQ (le16_to_cpu (hdr->frame_ctl))) { tkey->tx_hdr[12 ] = *(skb->data + hdr_len -2 ) &0x07 ; }// }
@@ -612,7 +612,7 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,michael_mic_hdr (skb, tkey->rx_hdr);// { david, 2006.9.1 // fix the wpa process with wmm enabled. -if (IEEE80211_QOS_HAS_SEQ (le16_to_cpu (hdr->frame_ctl))) { +if (IEEE80211_QOS_HAS_SEQ (le16_to_cpu (hdr->frame_ctl))) { tkey->rx_hdr[12 ] = *(skb->data + hdr_len -2 ) &0x07 ; }// }
Signature · 1 line
2.4.10
PATCH 5/8 Staging: rtl8192u: ieee80211: corrected indent
In reply to Kurt KanzenbachThis patch corrects the indentation in five instances in the ieee80211_crypt_tkip.c file.
--- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +5 -5
@@ -303,7 +303,7 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,static int ieee80211_tkip_encrypt (struct sk_buff *skb,int hdr_len,void *priv) {struct ieee80211_tkip_data *tkey = priv; -int len; +int len;u8 *pos;struct rtl_80211_hdr_4addr *hdr;cb_desc *tcb_desc = (cb_desc *)(skb->cb +MAX_DEV_ADDR_SIZE );
@@ -322,12 +322,12 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)if (!tcb_desc->bHwSec) {if (!tkey->tx_phase1_done) {tkip_mixing_phase1 (tkey->tx_ttak, tkey->key, hdr->addr2, - tkey->tx_iv32); + tkey->tx_iv32); tkey->tx_phase1_done =1 ; }tkip_mixing_phase2 (rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16); }else - tkey->tx_phase1_done =1 ; + tkey->tx_phase1_done =1 ; len = skb->len - hdr_len;
@@ -598,7 +598,7 @@ static void ieee80211_michael_mic_failure(struct net_device *dev, }static int ieee80211_michael_mic_verify (struct sk_buff *skb,int keyidx, -int hdr_len,void *priv) +int hdr_len,void *priv) {struct ieee80211_tkip_data *tkey = priv;u8 mic[8 ];
@@ -618,7 +618,7 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,// } if (michael_mic (tkey->rx_tfm_michael, &tkey->key[24 ], tkey->rx_hdr, - skb->data + hdr_len, skb->len -8 - hdr_len, mic)) + skb->data + hdr_len, skb->len -8 - hdr_len, mic))return -1 ;if (memcmp (mic, skb->data + skb->len -8 ,8 ) !=0 ) {struct rtl_80211_hdr_4addr *hdr;
Signature · 1 line
2.4.10
PATCH 6/8 Staging: rtl8192u: ieee80211: corrected block comments
In reply to Kurt KanzenbachThis patch reformats some block comments in order to match the Linux kernel coding style.
--- .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 31 +++++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +21 -10
@@ -256,8 +256,10 @@ static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)static void tkip_mixing_phase2 (u8 *WEPSeed,const u8 *TK ,const u16 *TTAK ,u16 IV16 ) { -/* Make temporary area overlap WEP seed so that the final copy can be -* avoided on little endian hosts. */ +/* +* Make temporary area overlap WEP seed so that the final copy can be +* avoided on little endian hosts. +*/ u16 *PPK = (u16 *) &WEPSeed[4 ];/* Step 1 - make copy of TTAK and bring in TSC */
@@ -283,8 +285,10 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,PPK [4 ] +=RotR1 (PPK [3 ]);PPK [5 ] +=RotR1 (PPK [4 ]); -/* Step 3 - bring in last of TK bits, assign 24-bit WEP IV value -* WEPSeed[0..2] is transmitted as WEP IV */ +/* +* Step 3 - bring in last of TK bits, assign 24-bit WEP IV value +* WEPSeed[0..2] is transmitted as WEP IV +*/ WEPSeed[0 ] =Hi8 (IV16 ); WEPSeed[1 ] = (Hi8 (IV16 ) |0x20 ) &0x7F ; WEPSeed[2 ] =Lo8 (IV16 );
@@ -463,8 +467,11 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)if (memcmp (icv, pos + plen,4 ) !=0 ) {if (iv32 != tkey->rx_iv32) { -/* Previously cached Phase1 result was already lost, so -* it needs to be recalculated for the next packet. */ +/* +* Previously cached Phase1 result was already +* lost, so it needs to be recalculated for the +* next packet. +*/ tkey->rx_phase1_done =0 ; }if (net_ratelimit ()) {
@@ -477,8 +484,10 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) } -/* Update real counters only after Michael MIC verification has -* completed */ +/* +* Update real counters only after Michael MIC verification has +* completed. +*/ tkey->rx_iv32_new = iv32; tkey->rx_iv16_new = iv16;
@@ -633,8 +642,10 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,return -1 ; } -/* Update TSC counters for RX now that the packet verification has -* completed. */ +/* +* Update TSC counters for RX now that the packet verification has +* completed. +*/ tkey->rx_iv32 = tkey->rx_iv32_new; tkey->rx_iv16 = tkey->rx_iv16_new;
Signature · 1 line
2.4.10
PATCH 7/8 Staging: rtl8192u: ieee80211: removed unnecessary braces
In reply to Kurt KanzenbachThis patch fixes the following checkpatch warning:
- WARNING: braces {} are not necessary for single statement blocks
--- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +2 -4
@@ -572,9 +572,8 @@ static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *pri// { david, 2006.9.1 // fix the wpa process with wmm enabled. -if (IEEE80211_QOS_HAS_SEQ (le16_to_cpu (hdr->frame_ctl))) { +if (IEEE80211_QOS_HAS_SEQ (le16_to_cpu (hdr->frame_ctl))) tkey->tx_hdr[12 ] = *(skb->data + hdr_len -2 ) &0x07 ; - }// } pos =skb_put (skb,8 );
@@ -621,9 +620,8 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,michael_mic_hdr (skb, tkey->rx_hdr);// { david, 2006.9.1 // fix the wpa process with wmm enabled. -if (IEEE80211_QOS_HAS_SEQ (le16_to_cpu (hdr->frame_ctl))) { +if (IEEE80211_QOS_HAS_SEQ (le16_to_cpu (hdr->frame_ctl))) tkey->rx_hdr[12 ] = *(skb->data + hdr_len -2 ) &0x07 ; - }// } if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
Signature · 1 line
2.4.10
PATCH 8/8 Staging: rtl8192u: ieee80211: added missing blank lines
In reply to Kurt KanzenbachThis patch resolves the following checkpatch warnings:
- WARNING: Missing a blank line after declarations
--- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +5 -0
@@ -297,6 +297,7 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,#ifdef __BIG_ENDIAN {int i; +for (i =0 ; i <6 ; i++)PPK [i] = (PPK [i] <<8 ) | (PPK [i] >>8 ); }
@@ -395,6 +396,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)u32 crc;struct scatterlist sg;int plen; +if (skb->len < hdr_len +8 +4 )return -1 ;
@@ -630,6 +632,7 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,if (memcmp (mic, skb->data + skb->len -8 ,8 ) !=0 ) {struct rtl_80211_hdr_4addr *hdr; hdr = (struct rtl_80211_hdr_4addr *) skb->data; + printk(KERN_DEBUG "%s: Michael MIC verification failed for " "MSDU from %pM keyidx=%d\n", skb->dev ? skb->dev->name : "N/A", hdr->addr2,
@@ -703,6 +706,7 @@ static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)/* Return the sequence number of the last transmitted frame. */ u16 iv16 = tkey->tx_iv16;u32 iv32 = tkey->tx_iv32; +if (iv16 ==0 ) iv32--; iv16--;
@@ -721,6 +725,7 @@ static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)static char *ieee80211_tkip_print_stats (char *p,void *priv) {struct ieee80211_tkip_data *tkip = priv; + p +=sprintf (p,"key[%d] alg=TKIP key_set=%d " "tx_pn=%02x%02x%02x%02x%02x%02x " "rx_pn=%02x%02x%02x%02x%02x%02x "
Signature · 1 line
2.4.10