staging: rtl8192e: fix checkpatch issues in rtllib_crypt_ccmp.c
cover staging: rtl8192e: fix checkpatch issues in rtllib_crypt_ccmp.c
Fix several issues reported by checkpatch in rtllib_crypt_ccmp.c file.
Khadija Kamran (5):
staging: rtl8192e: remove extra blank lines in rtllib_crypt_ccmp.c
staging: rtl8192e: fix alignment to match open parenthesis
staging: rtl8192e: avoid camel-case <dot11RSNAStatsCCMPFormatErrors>
staging: rtl8192e: avoid camel-case <dot11RSNAStatsCCMPReplays>
staging: rtl8192e: avoid camel-case <dot11RSNAStatsCCMPDecryptErrors>
drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | 33 +++++++------------- 1 file changed, 12 insertions(+), 21 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/5 staging: rtl8192e: remove extra blank lines in rtllib_crypt_ccmp.c
Remove extra blank lines as suggested by the Linux kernel coding-style. These issues were reported by checkpatch.
"CHECK: Please don't use multiple blank lines"
--- drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +0 -10
@@ -74,7 +74,6 @@ static void *rtllib_ccmp_init(int key_idx)return NULL ; } -static void rtllib_ccmp_deinit (void *priv) {struct rtllib_ccmp_data *_priv = priv;
@@ -84,7 +83,6 @@ static void rtllib_ccmp_deinit(void *priv)kfree (priv); } -static int ccmp_init_iv_and_aad (struct rtllib_hdr_4addr *hdr,u8 *pn,u8 *iv,u8 *aad) {
@@ -150,8 +148,6 @@ static int ccmp_init_iv_and_aad(struct rtllib_hdr_4addr *hdr,return aad_len; } - -static int rtllib_ccmp_encrypt (struct sk_buff *skb,int hdr_len,void *priv) {struct rtllib_ccmp_data *key = priv;
@@ -220,7 +216,6 @@ static int rtllib_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)return 0 ; } -static int rtllib_ccmp_decrypt (struct sk_buff *skb,int hdr_len,void *priv) {struct rtllib_ccmp_data *key = priv;
@@ -315,7 +310,6 @@ static int rtllib_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)return keyidx; } -static int rtllib_ccmp_set_key (void *key,int len,u8 *seq,void *priv) {struct rtllib_ccmp_data *data = priv;
@@ -349,7 +343,6 @@ static int rtllib_ccmp_set_key(void *key, int len, u8 *seq, void *priv)return 0 ; } -static int rtllib_ccmp_get_key (void *key,int len,u8 *seq,void *priv) {struct rtllib_ccmp_data *data = priv;
@@ -373,7 +366,6 @@ static int rtllib_ccmp_get_key(void *key, int len, u8 *seq, void *priv)return CCMP_TK_LEN ; } -static void rtllib_ccmp_print_stats (struct seq_file *m,void *priv) {struct rtllib_ccmp_data *ccmp = priv;
@@ -403,13 +395,11 @@ static struct lib80211_crypto_ops rtllib_crypt_ccmp = { .owner = THIS_MODULE, }; -static int __init rtllib_crypto_ccmp_init (void ) {return lib80211_register_crypto_ops (&rtllib_crypt_ccmp); } - static void __exit rtllib_crypto_ccmp_exit(void) {lib80211_unregister_crypto_ops (&rtllib_crypt_ccmp);
Signature · 1 line
2.34.1
PATCH 2/5 staging: rtl8192e: fix alignment to match open parenthesis
In reply to Khadija KamranFix alignemnt to match opening parenthesis as suggested by Linux kernel coding-style. This issue is reported by checkpatch.
--- drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +1 -1
@@ -332,7 +332,7 @@ static int rtllib_ccmp_set_key(void *key, int len, u8 *seq, void *priv) data->rx_pn[5 ] = seq[0 ]; }if (crypto_aead_setauthsize (data->tfm,CCMP_MIC_LEN ) || -crypto_aead_setkey (data->tfm, data->key,CCMP_TK_LEN )) +crypto_aead_setkey (data->tfm, data->key,CCMP_TK_LEN ))return -1 ; }else if (len ==0 ) { data->key_set =0 ;
Signature · 1 line
2.34.1
PATCH 3/5 staging: rtl8192e: avoid camel-case <dot11RSNAStatsCCMPFormatErrors>
In reply to Khadija KamranLinux kernel coding-style does not suggest mixed-case names. This issue is reported by checkpatch.
Fix variable name by changing it from camel-case to lower-case. In order to describe the variable name better, add a comment above it.
--- drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +5 -4
@@ -34,7 +34,8 @@ struct rtllib_ccmp_data {u8 tx_pn[CCMP_PN_LEN ];u8 rx_pn[CCMP_PN_LEN ]; -u32 dot11RSNAStatsCCMPFormatErrors; +/* .11 RSNA stats for CCMP */ +u32 ccmp_format_errors;u32 dot11RSNAStatsCCMPReplays;u32 dot11RSNAStatsCCMPDecryptErrors;
@@ -226,7 +227,7 @@ static int rtllib_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)u8 pn[6 ];if (skb->len < hdr_len +CCMP_HDR_LEN +CCMP_MIC_LEN ) { - key->dot11RSNAStatsCCMPFormatErrors++; + key->ccmp_format_errors++;return -1 ; }
@@ -238,7 +239,7 @@ static int rtllib_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)pr_debug ("CCMP: received packet without ExtIV flag from %pM\n" , hdr->addr2); } - key->dot11RSNAStatsCCMPFormatErrors++; + key->ccmp_format_errors++;return -2 ; } keyidx >>=6 ;
@@ -374,7 +375,7 @@ static void rtllib_ccmp_print_stats(struct seq_file *m, void *priv)"key[%d] alg=CCMP key_set=%d tx_pn=%pM rx_pn=%pM format_errors=%d replays=%d decrypt_errors=%d\n" , ccmp->key_idx, ccmp->key_set, ccmp->tx_pn, ccmp->rx_pn, - ccmp->dot11RSNAStatsCCMPFormatErrors, + ccmp->ccmp_format_errors, ccmp->dot11RSNAStatsCCMPReplays, ccmp->dot11RSNAStatsCCMPDecryptErrors); }
Signature · 1 line
2.34.1
PATCH 4/5 staging: rtl8192e: avoid camel-case <dot11RSNAStatsCCMPReplays>
In reply to Khadija KamranLinux kernel coding-style suggests to not use mixed-case names. Fix checkpatch issue by changing the variable name from camel-case to lower-case.
--- drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +3 -3
@@ -36,7 +36,7 @@ struct rtllib_ccmp_data {/* .11 RSNA stats for CCMP */ u32 ccmp_format_errors; -u32 dot11RSNAStatsCCMPReplays; +u32 ccmp_replays;u32 dot11RSNAStatsCCMPDecryptErrors;int key_idx;
@@ -264,7 +264,7 @@ static int rtllib_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) pn[5 ] = pos[0 ]; pos +=8 ;if (memcmp (pn, key->rx_pn,CCMP_PN_LEN ) <=0 ) { - key->dot11RSNAStatsCCMPReplays++; + key->ccmp_replays++;return -4 ; }if (!tcb_desc->bHwSec) {
@@ -376,7 +376,7 @@ static void rtllib_ccmp_print_stats(struct seq_file *m, void *priv) ccmp->key_idx, ccmp->key_set, ccmp->tx_pn, ccmp->rx_pn, ccmp->ccmp_format_errors, - ccmp->dot11RSNAStatsCCMPReplays, + ccmp->ccmp_replays, ccmp->dot11RSNAStatsCCMPDecryptErrors); }
Signature · 1 line
2.34.1
PATCH 5/5 staging: rtl8192e: avoid camel-case <dot11RSNAStatsCCMPDecryptErrors>
In reply to Khadija KamranLinux kernel coding-style suggests to not use mixed-case names. Fix checkpatch issue by changing the variable name from camel-case to lower-case.
--- drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +3 -3
@@ -37,7 +37,7 @@ struct rtllib_ccmp_data {/* .11 RSNA stats for CCMP */ u32 ccmp_format_errors;u32 ccmp_replays; -u32 dot11RSNAStatsCCMPDecryptErrors; +u32 ccmp_decrypt_errors;int key_idx;
@@ -297,7 +297,7 @@ static int rtllib_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)pr_debug ("CCMP: decrypt failed: STA= %pM\n" , hdr->addr2); } - key->dot11RSNAStatsCCMPDecryptErrors++; + key->ccmp_decrypt_errors++;return -5 ; }
@@ -377,7 +377,7 @@ static void rtllib_ccmp_print_stats(struct seq_file *m, void *priv) ccmp->tx_pn, ccmp->rx_pn, ccmp->ccmp_format_errors, ccmp->ccmp_replays, - ccmp->dot11RSNAStatsCCMPDecryptErrors); + ccmp->ccmp_decrypt_errors); }static struct lib80211_crypto_ops rtllib_crypt_ccmp = {
Signature · 1 line
2.34.1
Re: [PATCH 3/5] staging: rtl8192e: avoid camel-case <dot11RSNAStatsCCMPFormatErrors>
In reply to Khadija KamranQuoted 6 lines · Khadija Kamran
Linux kernel coding-style does not suggest mixed-case names. This issue is reported by checkpatch.
Fix variable name by changing it from camel-case to lower-case. In order to describe the variable name better, add a comment above it.
I think you are changing from camel case to snake case.
Quoted 11 lines
Suggested-by Deepak R Varma <[email protected]>Signed-off-by Khadija Kamran <[email protected]>--- drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +0
-0
drivers/staging/rtl8192e/rtllib_crypt_ccmp.c struct rtllib_ccmp_data { · line 40
Quoted 8 lines
drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +2
-1@@ -34,7 +34,8 @@ struct rtllib_ccmp_data {u8 tx_pn[CCMP_PN_LEN ];u8 rx_pn[CCMP_PN_LEN ]; -u32 dot11RSNAStatsCCMPFormatErrors; +/* .11 RSNA stats for CCMP */ +u32 ccmp_format_errors;u32 dot11RSNAStatsCCMPReplays;u32 dot11RSNAStatsCCMPDecryptErrors;
Is it obvious that CCMPFormatErrors is a part of dot11RSNAStats? OK. You added a comment. Often for me the issue is that the comment is only valid to one line or to more?
I would prefer something like: dot11rsna_stats_ccmp_format_err
This is keeping the information the author gave variable and I would understand better and see it in every place.
Quoted 28 lines
drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +3
-3@@ -226,7 +227,7 @@ static int rtllib_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)u8 pn[6 ];if (skb->len < hdr_len +CCMP_HDR_LEN +CCMP_MIC_LEN ) { - key->dot11RSNAStatsCCMPFormatErrors++; + key->ccmp_format_errors++;return -1 ; }@@ -238,7 +239,7 @@ static int rtllib_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)pr_debug ("CCMP: received packet without ExtIV flag from %pM\n" , hdr->addr2); } - key->dot11RSNAStatsCCMPFormatErrors++; + key->ccmp_format_errors++;return -2 ; } keyidx >>=6 ;@@ -374,7 +375,7 @@ static void rtllib_ccmp_print_stats(struct seq_file *m, void *priv)"key[%d] alg=CCMP key_set=%d tx_pn=%pM rx_pn=%pM format_errors=%d replays=%d decrypt_errors=%d\n" , ccmp->key_idx, ccmp->key_set, ccmp->tx_pn, ccmp->rx_pn, - ccmp->dot11RSNAStatsCCMPFormatErrors, + ccmp->ccmp_format_errors, ccmp->dot11RSNAStatsCCMPReplays, ccmp->dot11RSNAStatsCCMPDecryptErrors); }