Re: [PATCH v5 4/6] iio: dac: ad5504: remove legacy platform data support
| Newsgroups | org.kernel.vger.linux-devicetree |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: Pre-existing issues: - [High] The driver unconditionally dereferences `spi_get_device_id()` without checking for NULL. -- --- Patch [4]: [PATCH v5 4/6] iio: dac: ad5504: remove legacy platform data support --- commit 71e5a82418860f4a272cfaab189a444dee114159 Author: Taha Ed-Dafili <[email protected]> iio: dac: ad5504: remove legacy platform data support This commit removes the legacy platform data support from the AD5504 driver since there are no in-tree users. It drops the ad5504_platform_data structure and updates the probe logic to treat the vcc regulator as mandatory on non-ACPI systems. > diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c > index 830b8ea8eaebf..96ab6d456d80e 100644 > --- a/drivers/iio/dac/ad5504.c > +++ b/drivers/iio/dac/ad5504.c > @@ -296,16 +294,11 @@ static int ad5504_probe(struct spi_device *spi) [ ... ] > } > > st->spi = spi; > indio_dev->name = spi_get_device_id(st->spi)->name; > indio_dev->info = &ad5504_info; > if (spi_get_device_id(st->spi)->driver_data == ID_AD5501) [Severity: High] This is a pre-existing issue, but does this code unconditionally dereference the return value of spi_get_device_id() in ad5504_probe()? If a privileged user writes an unmatched device name to the driver's sysfs bind or driver_override interface, it forces a driver match via device_match_driver_override(). Because the device's modalias might not be in the driver's id_table, spi_match_id() would return NULL. Could this sequence lead to spi_get_device_id() returning NULL and causing a kernel panic when its name or driver_data fields are accessed here? -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4