Re: [PATCH v2 2/2] software node: Fix software_node_get_reference_args() with index -1

From: Zijun Hu

Date: Mon Jun 29 2026 - 08:43:16 EST


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.