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

Rodrigo Alencar <[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 <gy2dn5emz7sreavy6kioz27f3sx2ip6zhkgzs2uz4qzecpkrbe@zgsortof6aqn>
On 17/07/26 11:15, Andy Shevchenko wrote:
> On Fri, Jul 17, 2026 at 07:51:35AM +0100, Rodrigo Alencar wrote:
> > On 16/07/26 21:42, Andy Shevchenko wrote:
> > > On Thu, Jul 16, 2026 at 01:14:18PM +0100, Rodrigo Alencar via B4 Relay wrote:
> 
> ...
> 
> > > >  	struct iio_dev *indio_dev;
> > > >  	int ret, i;
> > > 
> > > Move an assignment here as well.
> > > 
> > > 	chip_info = ...
> > 
> > assignment? this is an input param validation
> 
> Can we make sure we always get a correct one to begin with?
> With that an assignment and check can be coupled together.
> Also consider use -ENODATA as it's most likely comes from
> driver_data.

I suppose you are suggesting to move the check to the bus code with:

	info = i2c_get_match_data(i2c);
	if (!info)
		return -ENODATA;

rather than here in the core/common code.
 
> > > > +	if (!chip_info)
> > > > +		return -ENODEV;

-- 
Kind regards,

Rodrigo Alencar
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.