All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: nbd@nbd.name
Cc: linux-wireless@vger.kernel.org
Subject: [bug report] mt76: fix transmission of encrypted management frames
Date: Tue, 30 Jan 2018 15:39:56 +0300	[thread overview]
Message-ID: <20180130123956.GA9178@mwanda> (raw)

Hello Felix Fietkau,

The patch 23405236460b: "mt76: fix transmission of encrypted
management frames" from Jan 18, 2018, leads to the following static
checker warning:

	drivers/net/wireless/mediatek/mt76/mt76x2_tx.c:41 mt76x2_tx()
	warn: always true condition '(wcid->hw_key_idx != -1) => (0-255 != (-1))'

drivers/net/wireless/mediatek/mt76/mt76x2_tx.c
    26  void mt76x2_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
    27               struct sk_buff *skb)
    28  {
    29          struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
    30          struct mt76x2_dev *dev = hw->priv;
    31          struct ieee80211_vif *vif = info->control.vif;
    32          struct mt76_wcid *wcid = &dev->global_wcid;
    33  
    34          if (control->sta) {
    35                  struct mt76x2_sta *msta;
    36  
    37                  msta = (struct mt76x2_sta *) control->sta->drv_priv;
    38                  wcid = &msta->wcid;
    39          }
    40  
    41          if (vif || (!info->control.hw_key && wcid->hw_key_idx != -1)) {
                                                     ^^^^^^^^^^^^^^^^^^^^^^
We set ->hw_key_idx to -1 but it's a u8 so it gets truncated to 0xFF.
This should probably be a define anyway.

    42                  struct mt76x2_vif *mvif;
    43  
    44                  mvif = (struct mt76x2_vif *) vif->drv_priv;
    45                  wcid = &mvif->group_wcid;
    46          }
    47  
    48          mt76_tx(&dev->mt76, control->sta, wcid, skb);
    49  }

regards,
dan carpenter

             reply	other threads:[~2018-01-30 12:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-30 12:39 Dan Carpenter [this message]
2018-01-30 13:03 ` [bug report] mt76: fix transmission of encrypted management frames Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180130123956.GA9178@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@nbd.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.