Re: [PATCH v8 2/8] iio: dac: ad5686: missing NULL check on match data

Joshua Crofts <[email protected]>
Newsgroups org.kernel.vger.linux-hardening,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Thu, 16 Jul 2026 13:14:18 +0100
Rodrigo Alencar via B4 Relay <[email protected]> wrote:

> From: Rodrigo Alencar <[email protected]>
> 
> Verify that chip_info pointer is not NULL. If a user binds the driver
> using driver_override via sysfs with a device name not present in the
> id_table or of_match_table, match data will be NULL.
> 
> Fixes: 0eb1728461a1 ("iio: dac: ad5686: drop enum id")
> Reported-by: [email protected]
> Closes: https://lore.kernel.org/all/[email protected]/
> Signed-off-by: Rodrigo Alencar <[email protected]>
> ---
>  drivers/iio/dac/ad5686.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
> index 713fe71ad1e7..d34250647aa4 100644
> --- a/drivers/iio/dac/ad5686.c
> +++ b/drivers/iio/dac/ad5686.c
> @@ -479,6 +479,9 @@ int ad5686_probe(struct device *dev,
>  	struct iio_dev *indio_dev;
>  	int ret, i;
>  
> +	if (!chip_info)
> +		return -ENODEV;
> +
>  	indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
>  	if (indio_dev == NULL)
>  		return  -ENOMEM;
> 

LGTM.

Reviewed-by: Joshua Crofts <[email protected]>

-- 
Kind regards

CJD
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.