lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9aec4249-6457-4e3b-13dd-baf02d4fbfad@ispras.ru>
Date:   Wed, 15 Mar 2023 01:03:23 +0300
From:   Alexey Khoroshilov <khoroshilov@...ras.ru>
To:     Andi Shyti <andi.shyti@...nel.org>,
        Linus Walleij <linus.walleij@...aro.org>
Cc:     Lars-Peter Clausen <lars@...afoo.de>, lvc-project@...uxtesting.org,
        Kasumov Ruslan <xhxgldhlpfy@...il.com>,
        linux-arm-msm@...r.kernel.org,
        Bjorn Andersson <andersson@...nel.org>,
        linux-kernel@...r.kernel.org,
        Konrad Dybcio <konrad.dybcio@...aro.org>,
        linux-iio@...r.kernel.org, Andy Gross <agross@...nel.org>,
        Kasumov Ruslan <s02210418@....cs.msu.ru>,
        Jonathan Cameron <jic23@...nel.org>
Subject: Re: [lvc-project] [PATCH] iio: adc: qcom-pm8xxx-xoadc: Remove useless
 condition in pm8xxx_xoadc_parse_channel()

On 15.03.2023 00:28, Andi Shyti wrote:
> Hi,
> 
>>> The left side of the loop condition never becomes false.
>>> hwchan cannot be NULL, because it points to elements of the
>>> hw_channels array that takes one of 4 predefined values:
>>> pm8018_xoadc_channels, pm8038_xoadc_channels,
>>> pm8058_xoadc_channels, pm8921_xoadc_channels.
>>>
>>> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>>
>> I am not impressed with that tool. See below:
>>
>>> Fixes: 63c3ecd946d4 ("iio: adc: add a driver for Qualcomm PM8xxx HK/XOADC")
>>> Signed-off-by: Kasumov Ruslan <s02210418@....cs.msu.ru>
>>
>> (...)
>>>         hwchan = &hw_channels[0];
>>> -       while (hwchan && hwchan->datasheet_name) {
>>> +       while (hwchan->datasheet_name) {
>>>                 if (hwchan->pre_scale_mux == pre_scale_mux &&
>>>                     hwchan->amux_channel == amux_channel)
>>>                         break;
>>
>> NAK have you tested this on a real system?
>>
>> Here is the complete loop:
>>
>>         hwchan = &hw_channels[0];
>>         while (hwchan && hwchan->datasheet_name) {
>>                 if (hwchan->pre_scale_mux == pre_scale_mux &&
>>                     hwchan->amux_channel == amux_channel)
>>                         break;
>>                 hwchan++;
> 
> ops, yes, sorry, I overlooked at this... This becomes NULL at
> some point as there is a sentinel in the _variant structures.
> 

Could you please clarify what do you mean.

As far as I can see sentinel is an "empty" element of xoadc_channel in
the array, i.e. hwchan->datasheet_name works as a sentinel while hwchan
is always non NULL.

--
Alexey

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ