staging: rtl8192u: ieee80211: ieee80211_crypt_ccmp.c: Replace bit shifting with BIT...
authorPayal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
Tue, 2 Apr 2019 13:28:33 +0000 (18:58 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 2 Apr 2019 17:57:11 +0000 (19:57 +0200)
Challenge suggested by coccinelle.
Prefer using BIT and replace bit shifting with the BIT(x) macro.

Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c

index 3534ddb900d1e5146270bab8cd23caeb17ce0746..e154df823a95bb1220301ab4f89e416f824edf5e 100644 (file)
@@ -216,7 +216,7 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
        *pos++ = key->tx_pn[5];
        *pos++ = key->tx_pn[4];
        *pos++ = 0;
-       *pos++ = (key->key_idx << 6) | (1 << 5) /* Ext IV included */;
+       *pos++ = (key->key_idx << 6) | BIT(5) /* Ext IV included */;
        *pos++ = key->tx_pn[3];
        *pos++ = key->tx_pn[2];
        *pos++ = key->tx_pn[1];
@@ -274,7 +274,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
        hdr = (struct rtl_80211_hdr_4addr *)skb->data;
        pos = skb->data + hdr_len;
        keyidx = pos[3];
-       if (!(keyidx & (1 << 5))) {
+       if (!(keyidx & BIT(5))) {
                if (net_ratelimit()) {
                        netdev_dbg(skb->dev, "CCMP: received packet without ExtIV flag from %pM\n",
                                   hdr->addr2);