From: Dan Carpenter <dan.carpenter@oracle.com>
To: helmut.schaa@googlemail.com
Cc: linux-wireless@vger.kernel.org
Subject: re: rt2x00: Don't call ieee80211_get_tx_rate for MCS rates
Date: Thu, 19 Jul 2012 14:33:08 +0300 [thread overview]
Message-ID: <20120719113308.GA32491@elgon.mountain> (raw)
Hello Helmut Schaa,
I'm going through some old static checker warnings and I was concerned
about this one:
The patch 55b585e29095: "rt2x00: Don't call ieee80211_get_tx_rate for
MCS rates" from Mar 3, 2011, leads to the following warning:
drivers/net/wireless/rt2x00/rt2x00queue.c:508
rt2x00queue_create_tx_descriptor()
error: potential NULL dereference 'hwrate'.
482 /*
483 * Determine rate modulation.
484 */
485 if (txrate->flags & IEEE80211_TX_RC_GREEN_FIELD)
486 txdesc->rate_mode = RATE_MODE_HT_GREENFIELD;
hwrate is NULL here.
487 else if (txrate->flags & IEEE80211_TX_RC_MCS)
488 txdesc->rate_mode = RATE_MODE_HT_MIX;
489 else {
490 rate = ieee80211_get_tx_rate(rt2x00dev->hw, tx_info);
491 hwrate = rt2x00_get_rate(rate->hw_value);
492 if (hwrate->flags & DEV_RATE_OFDM)
493 txdesc->rate_mode = RATE_MODE_OFDM;
494 else
495 txdesc->rate_mode = RATE_MODE_CCK;
496 }
497
498 /*
499 * Apply TX descriptor handling by components
500 */
501 rt2x00crypto_create_tx_descriptor(rt2x00dev, skb, txdesc);
502 rt2x00queue_create_tx_descriptor_seq(rt2x00dev, skb, txdesc);
503
504 if (test_bit(REQUIRE_HT_TX_DESC, &rt2x00dev->cap_flags))
505 rt2x00queue_create_tx_descriptor_ht(rt2x00dev, skb, txdesc,
506 hwrate);
On this path we dereference dereference hwrate if IEEE80211_TX_RC_MCS is
not set, but we don't check for IEEE80211_TX_RC_GREEN_FIELD.
507 else
508 rt2x00queue_create_tx_descriptor_plcp(rt2x00dev, skb, txdesc,
509 hwrate);
On this patch we dereference hwrate unconditionally.
regards,
dan carpenter
next reply other threads:[~2012-07-19 11:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-19 11:33 Dan Carpenter [this message]
2012-07-19 11:46 ` rt2x00: Don't call ieee80211_get_tx_rate for MCS rates Helmut Schaa
2012-07-20 7:28 ` 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=20120719113308.GA32491@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=helmut.schaa@googlemail.com \
--cc=linux-wireless@vger.kernel.org \
/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.