[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d14fddd9-20f9-fe7e-6c12-b5a57c6855da@linux.intel.com>
Date: Thu, 19 May 2022 12:49:45 -0500
From: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To: Mark Brown <broonie@...nel.org>,
Alexey Khoroshilov <khoroshilov@...ras.ru>
Cc: ldv-project@...uxtesting.org, alsa-devel@...a-project.org,
Liam Girdwood <lgirdwood@...il.com>,
linux-kernel@...r.kernel.org, Takashi Iwai <tiwai@...e.com>
Subject: Re: [PATCH] ASoC: max98090: Remove unneeded check in
max98090_put_enab_tlv()
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...
Powered by blists - more mailing lists