Re: [PATCH] iio: frequency: admv1013: fix NULL pointer dereference on str
From: Andy Shevchenko
Date: Fri Feb 27 2026 - 11:23:47 EST
On Fri, Feb 27, 2026 at 04:14:10PM +0000, Nuno Sá wrote:
> On Fri, 2026-02-27 at 15:16 +0200, Antoniu Miclaus wrote:
> > When device_property_read_string() fails, str is left uninitialized
> > but the code falls through to strcmp(str, ...), dereferencing a garbage
> > pointer. Replace manual read/strcmp with device_property_match_string()
> > which handles the missing property case internally.
> > ---
>
> Semantically it is a bit odd to use device_property_match_string() given it's for arrays.
Exactly.
> But it allows for some code simplification so why not?! And we can always see it as
> an array of 1 element :)
Shouldn't it be device_property_match_property_string()?
--
With Best Regards,
Andy Shevchenko