Linux IIO development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Yang Zi <2959243019@qq.com>
Cc: jic23@kernel.org, linux-iio@vger.kernel.org,
	dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
	u.kleine-koenig@baylibre.com, dakr@kernel.org,
	o-takashi@sakamocchi.jp, email@sirat.me,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: proximity: sx9310: fix NULL pointer dereference in sx9310_check_whoami
Date: Wed, 26 Aug 2026 17:00:52 +0300	[thread overview]
Message-ID: <ao7xlDTRF8693n5z@ashevche-desk.local> (raw)
In-Reply-To: <tencent_1936AF0C31F45000EFB7B38019EFD4A06C07@qq.com>

On Tue, Aug 25, 2026 at 05:18:01PM +0800, Yang Zi wrote:
> device_get_match_data() can return NULL, e.g. when the device is matched
> through the I2C device ID table rather than the OF/ACPI match tables. In
> that case sx9310_check_whoami() dereferences a NULL pointer when reading
> ddata->whoami.
> 
> Return -ENODEV if no match data is found to avoid the NULL pointer
> dereference.

-ENODATA, please.

...

>      ddata = device_get_match_data(dev);
> +    if (!ddata)
> +        return -ENODEV;

+ blank line.

>      if (ddata->whoami != whoami)
>          return -ENODEV;
>  

-- 
With Best Regards,
Andy Shevchenko



  parent reply	other threads:[~2026-08-26 14:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25  9:18 [PATCH] iio: proximity: sx9310: fix NULL pointer dereference in sx9310_check_whoami Yang Zi
2026-08-25  9:28 ` Joshua Crofts
2026-08-26 14:00 ` Andy Shevchenko [this message]
2026-08-31  0:19 ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ao7xlDTRF8693n5z@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=2959243019@qq.com \
    --cc=andy@kernel.org \
    --cc=dakr@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=email@sirat.me \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=o-takashi@sakamocchi.jp \
    --cc=u.kleine-koenig@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox