Devicetree
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Alban Bedel <alban.bedel@lht.dlh.de>
Cc: driver-core@lists.linux.dev, devicetree@vger.kernel.org,
	Daniel Scally <djrscally@gmail.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>, Rob Herring <robh@kernel.org>,
	Saravana Kannan <saravanak@kernel.org>,
	Zijun Hu <zijun.hu@oss.qualcomm.com>,
	linux-kernel@vger.kernel.org, Sashiko <sashiko-bot@kernel.org>
Subject: Re: [PATCH v2 2/2] software node: Fix software_node_get_reference_args() with index -1
Date: Thu, 18 Jun 2026 20:35:59 +0200	[thread overview]
Message-ID: <ajQ6j5roSZ16Yb-M@black.igk.intel.com> (raw)
In-Reply-To: <20260618152035.1600436-2-alban.bedel@lht.dlh.de>

On Thu, Jun 18, 2026 at 05:20:35PM +0200, Alban Bedel wrote:
> The bounds check for the index passed to
> software_node_get_reference_args() was failing when passed UINT_MAX,
> this in turn would lead to an out of bound access in the property
> array. Fix the bound check to also cover the UINT_MAX case.

...

> -	if ((index + 1) * sizeof(*ref) > prop->length)
> +	if (index >= prop->length / sizeof(*ref))

It trades multiplication for division (which might be not always
power-of-two).

>  		return -ENOENT;

-- 
With Best Regards,
Andy Shevchenko



  parent reply	other threads:[~2026-06-18 18:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-18 15:20 [PATCH v2 1/2] of: property: Fix of_fwnode_get_reference_args() with negative index Alban Bedel
2026-06-18 15:20 ` [PATCH v2 2/2] software node: Fix software_node_get_reference_args() with index -1 Alban Bedel
2026-06-18 15:31   ` sashiko-bot
2026-06-18 18:35   ` Andy Shevchenko [this message]
2026-06-18 17:09 ` [PATCH v2 1/2] of: property: Fix of_fwnode_get_reference_args() with negative index Rob Herring (Arm)

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=ajQ6j5roSZ16Yb-M@black.igk.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=alban.bedel@lht.dlh.de \
    --cc=dakr@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=djrscally@gmail.com \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=saravanak@kernel.org \
    --cc=sashiko-bot@kernel.org \
    --cc=zijun.hu@oss.qualcomm.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