mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Grumbach, Emmanuel" <emmanuel.grumbach@intel.com>
To: Adrien Schildknecht <adrien+dev@schischi.me>,
	"Berg, Johannes" <johannes.berg@intel.com>
Cc: "ilw@linux.intel.com" <ilw@linux.intel.com>,
	"kvalo@codeaurora.org" <kvalo@codeaurora.org>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] iwlwifi: out-of-bounds access in iwl_init_sband_channels
Date: Fri, 14 Aug 2015 04:31:55 +0000	[thread overview]
Message-ID: <0BA3FCBA62E2DC44AF3030971E174FB32E7EA2CE@hasmsx107.ger.corp.intel.com> (raw)
In-Reply-To: <1439512532-7901-1-git-send-email-adrien+dev@schischi.me>

Hi,

On 08/14/2015 03:36 AM, Adrien Schildknecht wrote:
> Both loops of this function compare data from the 'chan' array and then
> check if the index is valid.
> 
> The 2 conditions should be inverted to avoid an out-of-bounds access.
> 

Was that found by a static analyzer or any other automated tool, or was
that the result of your very careful review?

> Signed-off-by: Adrien Schildknecht <adrien+dev@schischi.me>
> ---
>  drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c
> index 21302b6..acc3d18 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c
> @@ -713,12 +713,12 @@ int iwl_init_sband_channels(struct iwl_nvm_data *data,
>  	struct ieee80211_channel *chan = &data->channels[0];
>  	int n = 0, idx = 0;
>  
> -	while (chan->band != band && idx < n_channels)
> +	while (idx < n_channels && chan->band != band)
>  		chan = &data->channels[++idx];
>  
>  	sband->channels = &data->channels[idx];
>  
> -	while (chan->band == band && idx < n_channels) {
> +	while (idx < n_channels && chan->band == band) {
>  		chan = &data->channels[++idx];
>  		n++;
>  	}
> 

Looks fine - I'll pick it up.

  reply	other threads:[~2015-08-14  4:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-14  0:35 Adrien Schildknecht
2015-08-14  4:31 ` Grumbach, Emmanuel [this message]
2015-08-14  7:04   ` Adrien Schildknecht
2015-08-14  7:14     ` Kalle Valo
2015-08-14  9:05       ` [PATCH v2] " Adrien Schildknecht

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=0BA3FCBA62E2DC44AF3030971E174FB32E7EA2CE@hasmsx107.ger.corp.intel.com \
    --to=emmanuel.grumbach@intel.com \
    --cc=adrien+dev@schischi.me \
    --cc=ilw@linux.intel.com \
    --cc=johannes.berg@intel.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@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

all inboxes | Powered by JetHome®