linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luciano Coelho <luciano.coelho@intel.com>
To: Colin Ian King <colin.king@canonical.com>,
	Johannes Berg <johannes.berg@intel.com>,
	Emmanuel Grumbach <emmanuel.grumbach@intel.com>,
	Intel Linux Wireless <linuxwifi@intel.com>,
	Kalle Valo <kvalo@codeaurora.org>,
	"David S. Miller" <davem@davemloft.net>,
	Ihab Zhaika <ihab.zhaika@intel.com>,
	Shahar S Matityahu <shahar.s.matityahu@intel.com>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: iwlwifi: refactor the SAR tables from mvm to acpi
Date: Fri, 20 Dec 2019 07:40:44 +0200	[thread overview]
Message-ID: <21328530d3f15c75abca8107823a4578e5065ca6.camel@intel.com> (raw)
In-Reply-To: <18ea9fa8-93fe-f371-68ee-3d12eac252c8@canonical.com>

On Fri, 2019-12-20 at 00:02 +0000, Colin Ian King wrote:
> Hi,
> 
> Static analysis with Coverity has detected a potential issue with the
> following commit:
> 
> commit 39c1a9728f938c7255ce507c8d56b73e8a4ebddf
> Author: Ihab Zhaika <ihab.zhaika@intel.com>
> Date:   Fri Nov 15 09:28:11 2019 +0200
> 
>     iwlwifi: refactor the SAR tables from mvm to acpi
> 
> 
> in function iwl_sar_get_ewrd_table() we have an array index pos being
> initialized to 3 and then incremented each time a loop iterates:
> 
>         for (i = 0; i < n_profiles; i++) {
>                 /* the tables start at element 3 */
>                 int pos = 3;
> 
>                 /* The EWRD profiles officially go from 2 to 4, but we
>                  * save them in sar_profiles[1-3] (because we don't
>                  * have profile 0).  So in the array we start from 1.
>                  */
>                 ret = iwl_sar_set_profile(&wifi_pkg->package.elements[pos],
>                                           &fwrt->sar_profiles[i + 1],
>                                           enabled);
>                 if (ret < 0)
>                         break;
> 
>                 /* go to the next table */
>                 pos += ACPI_SAR_TABLE_SIZE;
>         }
> 
> So, each iteration is always accessing package.elements[3]. I'm not sure
> if that is intentional. If it is, then the increment of pos is not
> required.  Either way, it's not clear what the original intention is.

Good catch, thanks! We'll fix it.

--
Cheers,
Luca.


      reply	other threads:[~2019-12-20  5:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-20  0:02 iwlwifi: refactor the SAR tables from mvm to acpi Colin Ian King
2019-12-20  5:40 ` Luciano Coelho [this message]

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=21328530d3f15c75abca8107823a4578e5065ca6.camel@intel.com \
    --to=luciano.coelho@intel.com \
    --cc=colin.king@canonical.com \
    --cc=davem@davemloft.net \
    --cc=emmanuel.grumbach@intel.com \
    --cc=ihab.zhaika@intel.com \
    --cc=johannes.berg@intel.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linuxwifi@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=shahar.s.matityahu@intel.com \
    /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).