* [bug report] iio: adc: add a driver for Qualcomm PM8xxx HK/XOADC
@ 2023-03-22 9:09 Dan Carpenter
2023-03-23 8:11 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2023-03-22 9:09 UTC (permalink / raw)
To: linus.walleij; +Cc: linux-iio
[ No idea why this warning is showing up after 6 years. -dan ]
Hello Linus Walleij,
This is a semi-automatic email about new static checker warnings.
The patch 63c3ecd946d4: "iio: adc: add a driver for Qualcomm PM8xxx
HK/XOADC" from Apr 4, 2017, leads to the following Smatch complaint:
drivers/iio/adc/qcom-pm8xxx-xoadc.c:769 pm8xxx_xoadc_parse_channel()
error: we previously assumed 'hwchan' could be null (see line 761)
drivers/iio/adc/qcom-pm8xxx-xoadc.c
760 hwchan = &hw_channels[0];
Here the hw_channels is variant->channels so it potentially is NULL
(maybe? I don't know the context very well).
761 while (hwchan && hwchan->datasheet_name) {
^^^^^^
Check for NULL.
762 if (hwchan->pre_scale_mux == pre_scale_mux &&
763 hwchan->amux_channel == amux_channel)
764 break;
765 hwchan++;
766 chid++;
767 }
768 /* The sentinel does not have a name assigned */
769 if (!hwchan->datasheet_name) {
^^^^^^^^^^^^^^^^^^^^^^
Unchecked dereference.
770 dev_err(dev, "could not locate channel %02x/%02x\n",
771 pre_scale_mux, amux_channel);
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] iio: adc: add a driver for Qualcomm PM8xxx HK/XOADC
2023-03-22 9:09 [bug report] iio: adc: add a driver for Qualcomm PM8xxx HK/XOADC Dan Carpenter
@ 2023-03-23 8:11 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2023-03-23 8:11 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-iio
On Wed, Mar 22, 2023 at 10:09 AM Dan Carpenter <error27@gmail.com> wrote:
> [ No idea why this warning is showing up after 6 years. -dan ]
:D
> This is a semi-automatic email about new static checker warnings.
>
> The patch 63c3ecd946d4: "iio: adc: add a driver for Qualcomm PM8xxx
> HK/XOADC" from Apr 4, 2017, leads to the following Smatch complaint:
>
> drivers/iio/adc/qcom-pm8xxx-xoadc.c:769 pm8xxx_xoadc_parse_channel()
> error: we previously assumed 'hwchan' could be null (see line 761)
>
> drivers/iio/adc/qcom-pm8xxx-xoadc.c
> 760 hwchan = &hw_channels[0];
>
> Here the hw_channels is variant->channels so it potentially is NULL
> (maybe? I don't know the context very well).
>
> 761 while (hwchan && hwchan->datasheet_name) {
> ^^^^^^
> Check for NULL.
Actually there was a patch for this last week:
https://lore.kernel.org/linux-iio/20230314193709.15208-1-xhxgldhlpfy@gmail.com/
It seems the other static checker also found it now...
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-23 8:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22 9:09 [bug report] iio: adc: add a driver for Qualcomm PM8xxx HK/XOADC Dan Carpenter
2023-03-23 8:11 ` Linus Walleij
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.