linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: johannes.berg@intel.com
Cc: linux-wireless@vger.kernel.org
Subject: (bug report) iwlwifi: inconsitent NULL checking
Date: Thu, 26 Nov 2015 15:03:17 +0300	[thread overview]
Message-ID: <20151126120317.GJ10556@mwanda> (raw)

[ All old wireless warnings are showing up as new because the files
  moved around in linux-next.  - dan ]

Hello Johannes Berg,

The patch 8ca151b568b6: "iwlwifi: add the MVM driver" from Jan 24,
2013, leads to the following static checker warning:

	drivers/net/wireless/intel/iwlwifi/mvm/rs.c:2802 rs_get_rate()
	error: we previously assumed 'lq_sta' could be null (see line 2793)

drivers/net/wireless/intel/iwlwifi/mvm/rs.c
  2790          /* TODO: handle rate_idx_mask and rate_idx_mcs_mask */
  2791  
  2792          /* Treat uninitialized rate scaling data same as non-existing. */
  2793          if (lq_sta && !lq_sta->pers.drv) {
                    ^^^^^^
Check.

  2794                  IWL_DEBUG_RATE(mvm, "Rate scaling not initialized yet.\n");
  2795                  mvm_sta = NULL;
  2796          }
  2797  
  2798          /* Send management frames and NO_ACK data using lowest rate. */
  2799          if (rate_control_send_low(sta, mvm_sta, txrc))
  2800                  return;
  2801  
  2802          iwl_mvm_hwrate_to_tx_rate(lq_sta->last_rate_n_flags,
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^
Uchecked dereference.

  2803                                    info->band, &info->control.rates[0]);
  2804          info->control.rates[0].count = 1;
  2805  

See also:
drivers/net/wireless/intel/iwlwifi/dvm/rs.c:2742 rs_get_rate() error: we previously assumed 'lq_sta' could be null (see line 2733)


regards,
dan carpenter

             reply	other threads:[~2015-11-26 12:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-26 12:03 Dan Carpenter [this message]
2015-11-26 12:16 ` (bug report) iwlwifi: inconsitent NULL checking Johannes Berg
2015-11-26 12:37   ` Dan Carpenter
2015-11-26 12:51     ` Johannes Berg
2015-11-26 19:44       ` Dan Carpenter
2015-11-26 20:21         ` Johannes Berg

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=20151126120317.GJ10556@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=johannes.berg@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).