linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pkshih <pkshih@realtek.com>
To: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"colin.king@canonical.com" <colin.king@canonical.com>,
	"kvalo@codeaurora.org" <kvalo@codeaurora.org>,
	"Larry.Finger@lwfinger.net" <Larry.Finger@lwfinger.net>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: static analysis issue in rtl8188de driver
Date: Mon, 6 May 2019 07:56:30 +0000	[thread overview]
Message-ID: <1557129390.28660.4.camel@realtek.com> (raw)
In-Reply-To: <a1842b3e-f0af-d1a1-8609-a76c25dfd37b@canonical.com>

On Sat, 2019-05-04 at 21:50 +0000, Colin Ian King wrote:
> Hi,
> 
> Static analysis with Coverity has found an issue in the rtl8188de
> wireless driver in drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c
> in function tl92d_dm_txpower_tracking_callback_thermalmeter.
> 
> The issue is that u8 array ofdm_index[3] is never initialized, however
> it is decremented and incremented in two places resulting in garbage
> value from the stack being updated in the following code:
> 
> 	if (thermalvalue > rtlpriv->dm.thermalvalue) {
>         	for (i = 0; i < rf; i++)
>                 	ofdm_index[i] -= delta;
>         	cck_index -= delta;
> 	} else {
>         	for (i = 0; i < rf; i++)
>                 	ofdm_index[i] += index;
>         	cck_index += index;	
> 	}
> 
> At my first look at the code I believe ofdm_index should be just
> zero-initialized at declaration time, but I suspect that I'm overlooking
> something maybe a bit deeper. Any ideas?
> 


Hi Colin,

Thanks for your report.

After my quick look, there are at least two obvious problems.
One is array size of ofdm_index[] should be two instead. Another is the value
of ofdm_index[] should be obtained from rtlpriv->dm.ofdm_index[]. 
Since the logic is quite complex, I need some time to fix it.

PK


      reply	other threads:[~2019-05-06  7:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-04 21:50 static analysis issue in rtl8188de driver Colin Ian King
2019-05-06  7:56 ` Pkshih [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=1557129390.28660.4.camel@realtek.com \
    --to=pkshih@realtek.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=colin.king@canonical.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --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).