Commit 7bdfaa0a authored by Mateusz Kulikowski's avatar Mateusz Kulikowski Committed by Greg Kroah-Hartman

staging: rtl8192e: Fix PREFER_PR_LEVEL warnings

Fix most of remaining PREFER_PR_LEVEL warnings in rtllib.
Replace printk() with netdev_* if possible, pr_* in other cases.
Signed-off-by: default avatarMateusz Kulikowski <mateusz.kulikowski@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ca93dcba
...@@ -69,7 +69,7 @@ static void *rtllib_ccmp_init(int key_idx) ...@@ -69,7 +69,7 @@ static void *rtllib_ccmp_init(int key_idx)
priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->tfm)) { if (IS_ERR(priv->tfm)) {
pr_debug("rtllib_crypt_ccmp: could not allocate crypto API aes\n"); pr_debug("Could not allocate crypto API aes\n");
priv->tfm = NULL; priv->tfm = NULL;
goto fail; goto fail;
} }
......
...@@ -68,8 +68,7 @@ static void *rtllib_tkip_init(int key_idx) ...@@ -68,8 +68,7 @@ static void *rtllib_tkip_init(int key_idx)
priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0,
CRYPTO_ALG_ASYNC); CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->tx_tfm_arc4)) { if (IS_ERR(priv->tx_tfm_arc4)) {
printk(KERN_DEBUG pr_debug("Could not allocate crypto API arc4\n");
"rtllib_crypt_tkip: could not allocate crypto API arc4\n");
priv->tx_tfm_arc4 = NULL; priv->tx_tfm_arc4 = NULL;
goto fail; goto fail;
} }
...@@ -77,8 +76,7 @@ static void *rtllib_tkip_init(int key_idx) ...@@ -77,8 +76,7 @@ static void *rtllib_tkip_init(int key_idx)
priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0, priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
CRYPTO_ALG_ASYNC); CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->tx_tfm_michael)) { if (IS_ERR(priv->tx_tfm_michael)) {
printk(KERN_DEBUG pr_debug("Could not allocate crypto API michael_mic\n");
"rtllib_crypt_tkip: could not allocate crypto API michael_mic\n");
priv->tx_tfm_michael = NULL; priv->tx_tfm_michael = NULL;
goto fail; goto fail;
} }
...@@ -86,8 +84,7 @@ static void *rtllib_tkip_init(int key_idx) ...@@ -86,8 +84,7 @@ static void *rtllib_tkip_init(int key_idx)
priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0,
CRYPTO_ALG_ASYNC); CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->rx_tfm_arc4)) { if (IS_ERR(priv->rx_tfm_arc4)) {
printk(KERN_DEBUG pr_debug("Could not allocate crypto API arc4\n");
"rtllib_crypt_tkip: could not allocate crypto API arc4\n");
priv->rx_tfm_arc4 = NULL; priv->rx_tfm_arc4 = NULL;
goto fail; goto fail;
} }
...@@ -95,8 +92,7 @@ static void *rtllib_tkip_init(int key_idx) ...@@ -95,8 +92,7 @@ static void *rtllib_tkip_init(int key_idx)
priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0, priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
CRYPTO_ALG_ASYNC); CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->rx_tfm_michael)) { if (IS_ERR(priv->rx_tfm_michael)) {
printk(KERN_DEBUG pr_debug("Could not allocate crypto API michael_mic\n");
"rtllib_crypt_tkip: could not allocate crypto API michael_mic\n");
priv->rx_tfm_michael = NULL; priv->rx_tfm_michael = NULL;
goto fail; goto fail;
} }
...@@ -403,24 +399,24 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -403,24 +399,24 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
keyidx = pos[3]; keyidx = pos[3];
if (!(keyidx & (1 << 5))) { if (!(keyidx & (1 << 5))) {
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_DEBUG netdev_dbg(skb->dev,
"TKIP: received packet without ExtIV flag from %pM\n", "Received packet without ExtIV flag from %pM\n",
hdr->addr2); hdr->addr2);
} }
return -2; return -2;
} }
keyidx >>= 6; keyidx >>= 6;
if (tkey->key_idx != keyidx) { if (tkey->key_idx != keyidx) {
printk(KERN_DEBUG netdev_dbg(skb->dev,
"TKIP: RX tkey->key_idx=%d frame keyidx=%d priv=%p\n", "RX tkey->key_idx=%d frame keyidx=%d priv=%p\n",
tkey->key_idx, keyidx, priv); tkey->key_idx, keyidx, priv);
return -6; return -6;
} }
if (!tkey->key_set) { if (!tkey->key_set) {
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_DEBUG netdev_dbg(skb->dev,
"TKIP: received packet from %pM with keyid=%d that does not have a configured key\n", "Received packet from %pM with keyid=%d that does not have a configured key\n",
hdr->addr2, keyidx); hdr->addr2, keyidx);
} }
return -3; return -3;
} }
...@@ -433,10 +429,10 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -433,10 +429,10 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
(iv32 == tkey->rx_iv32 && iv16 <= tkey->rx_iv16)) && (iv32 == tkey->rx_iv32 && iv16 <= tkey->rx_iv16)) &&
tkey->initialized) { tkey->initialized) {
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_DEBUG netdev_dbg(skb->dev,
"TKIP: replay detected: STA= %pM previous TSC %08x%04x received TSC %08x%04x\n", "Replay detected: STA= %pM previous TSC %08x%04x received TSC %08x%04x\n",
hdr->addr2, tkey->rx_iv32, tkey->rx_iv16, hdr->addr2, tkey->rx_iv32,
iv32, iv16); tkey->rx_iv16, iv32, iv16);
} }
tkey->dot11RSNAStatsTKIPReplays++; tkey->dot11RSNAStatsTKIPReplays++;
return -4; return -4;
...@@ -457,9 +453,9 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -457,9 +453,9 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) { if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) {
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_DEBUG netdev_dbg(skb->dev,
": TKIP: failed to decrypt received packet from %pM\n", "Failed to decrypt received packet from %pM\n",
hdr->addr2); hdr->addr2);
} }
return -7; return -7;
} }
...@@ -479,9 +475,9 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -479,9 +475,9 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
tkey->rx_phase1_done = 0; tkey->rx_phase1_done = 0;
} }
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_DEBUG netdev_dbg(skb->dev,
"TKIP: ICV error detected: STA= %pM\n", "ICV error detected: STA= %pM\n",
hdr->addr2); hdr->addr2);
} }
tkey->dot11RSNAStatsTKIPICVErrors++; tkey->dot11RSNAStatsTKIPICVErrors++;
return -5; return -5;
...@@ -566,9 +562,9 @@ static int rtllib_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -566,9 +562,9 @@ static int rtllib_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv)
hdr = (struct rtllib_hdr_4addr *) skb->data; hdr = (struct rtllib_hdr_4addr *) skb->data;
if (skb_tailroom(skb) < 8 || skb->len < hdr_len) { if (skb_tailroom(skb) < 8 || skb->len < hdr_len) {
printk(KERN_DEBUG netdev_dbg(skb->dev,
"Invalid packet for Michael MIC add (tailroom=%d hdr_len=%d skb->len=%d)\n", "Invalid packet for Michael MIC add (tailroom=%d hdr_len=%d skb->len=%d)\n",
skb_tailroom(skb), hdr_len, skb->len); skb_tailroom(skb), hdr_len, skb->len);
return -1; return -1;
} }
...@@ -630,12 +626,11 @@ static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx, ...@@ -630,12 +626,11 @@ static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx,
struct rtllib_hdr_4addr *hdr; struct rtllib_hdr_4addr *hdr;
hdr = (struct rtllib_hdr_4addr *) skb->data; hdr = (struct rtllib_hdr_4addr *) skb->data;
printk(KERN_DEBUG netdev_dbg(skb->dev,
"%s: Michael MIC verification failed for MSDU from %pM keyidx=%d\n", "Michael MIC verification failed for MSDU from %pM keyidx=%d\n",
skb->dev ? skb->dev->name : "N/A", hdr->addr2, hdr->addr2, keyidx);
keyidx); netdev_dbg(skb->dev, "%d\n",
printk(KERN_DEBUG "%d\n", memcmp(mic, skb->data + skb->len - 8, 8) != 0);
memcmp(mic, skb->data + skb->len - 8, 8) != 0);
if (skb->dev) { if (skb->dev) {
pr_info("skb->dev != NULL\n"); pr_info("skb->dev != NULL\n");
rtllib_michael_mic_failure(skb->dev, hdr, keyidx); rtllib_michael_mic_failure(skb->dev, hdr, keyidx);
......
...@@ -346,8 +346,9 @@ rtllib_rx_frame_decrypt_msdu(struct rtllib_device *ieee, struct sk_buff *skb, ...@@ -346,8 +346,9 @@ rtllib_rx_frame_decrypt_msdu(struct rtllib_device *ieee, struct sk_buff *skb,
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv); res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
atomic_dec(&crypt->refcnt); atomic_dec(&crypt->refcnt);
if (res < 0) { if (res < 0) {
printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed (SA= %pM keyidx=%d)\n", netdev_dbg(ieee->dev,
ieee->dev->name, hdr->addr2, keyidx); "MSDU decryption/MIC verification failed (SA= %pM keyidx=%d)\n",
hdr->addr2, keyidx);
return -1; return -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment