public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Mark Brown <broonie@kernel.org>,
	Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: ldv-project@linuxtesting.org, alsa-devel@alsa-project.org,
	Liam Girdwood <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org, Takashi Iwai <tiwai@suse.com>
Subject: Re: [PATCH] ASoC: max98090: Remove unneeded check in max98090_put_enab_tlv()
Date: Thu, 19 May 2022 12:49:45 -0500	[thread overview]
Message-ID: <d14fddd9-20f9-fe7e-6c12-b5a57c6855da@linux.intel.com> (raw)
In-Reply-To: <YoZ+dmprwb5Ohto3@sirena.org.uk>



On 5/19/22 12:29, Mark Brown wrote:
> On Thu, May 19, 2022 at 08:10:12PM +0300, Alexey Khoroshilov wrote:
>> Variable sel is of unsigned int type, so sel < 0 is not required.
>>
>> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
>>  	val = (val >> mc->shift) & mask;
>>  
>> -	if (sel < 0 || sel > mc->max)
>> +	if (sel > mc->max)
> 
> The check needs to be moved, not removed.  The userspace ABI allows
> passing in of negative values.

I was about to send the same cleanup, cppcheck reports the same issue
with a useless test.

The problem is that the values coming from userspace are cast to unsigned...

  reply	other threads:[~2022-05-19 17:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-19 17:10 [PATCH] ASoC: max98090: Remove unneeded check in max98090_put_enab_tlv() Alexey Khoroshilov
2022-05-19 17:29 ` Mark Brown
2022-05-19 17:49   ` Pierre-Louis Bossart [this message]
2022-05-19 17:49   ` Alexey Khoroshilov
2022-05-19 17:54     ` Mark Brown
2022-05-19 18:27       ` Alexey Khoroshilov
2022-05-19 20:07         ` Mark Brown
2022-05-19 20:13           ` Alexey Khoroshilov
2022-05-19 20:31             ` Mark Brown
2022-05-19 22:31           ` [PATCH] ASoC: max98090: Move check for invalid values before casting " Alexey Khoroshilov
2022-05-20 16:58             ` Mark Brown

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=d14fddd9-20f9-fe7e-6c12-b5a57c6855da@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=khoroshilov@ispras.ru \
    --cc=ldv-project@linuxtesting.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tiwai@suse.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