Devicetree
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Zijun Hu <zijun_hu@icloud.com>
Cc: Zijun Hu <zijun.hu@oss.qualcomm.com>,
	Alban Bedel <alban.bedel@lht.dlh.de>,
	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>,
	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: Mon, 29 Jun 2026 16:13:51 +0300	[thread overview]
Message-ID: <akJvj3pxZwOAd97v@ashevche-desk.local> (raw)
In-Reply-To: <bdb69b50-ef98-47f5-92c1-48e73fd2da72@icloud.com>

On Mon, Jun 29, 2026 at 08:33:24PM +0800, Zijun Hu wrote:
> On 6/29/26 15:30, Andy Shevchenko wrote:

...

> >> who will use UINT_MAX ?
> >>
> >> This function is a interface function.  the best fix should check
> >> input parameter @index and return -EINVAL if it is not expected?
> > And how do you know which index is allowed without doing that division?
> > Basically this patch does what you asked for: check input parameter for
> > the allowed range (which is dynamic, depending on the property length and
> > size of the reference structure.
> 
> Introduce a common macro to limit the max reference handle count and put it
> in include/linux/fwnode.h with the following macro.
> #define NR_FWNODE_REFERENCE_ARGS        16
> 
> OR introduce a macro for software node only.

The property can be still smaller that capacity. I agree that division is not
the best approach performance-wise, but in my eyes it makes less checks needed
to be done. Let's see what others think about this?

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-06-29 13:13 UTC|newest]

Thread overview: 11+ 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
2026-06-22  8:41     ` Alban Bedel
2026-06-26 23:50   ` Zijun Hu
2026-06-29  7:30     ` Andy Shevchenko
2026-06-29 12:33       ` Zijun Hu
2026-06-29 13:13         ` Andy Shevchenko [this message]
2026-06-29 10:50     ` Alban Bedel
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=akJvj3pxZwOAd97v@ashevche-desk.local \
    --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 \
    --cc=zijun_hu@icloud.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