Re: [PATCH RFC v2] of: property: Fix potential firmware node reference's argument count got out of range

From: Andy Shevchenko
Date: Tue Jan 14 2025 - 12:02:10 EST


On Tue, Jan 14, 2025 at 11:51:13PM +0800, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
>
> Currently, the following two macros have different values:
>
> // The maximal argument count for firmware node reference
> #define NR_FWNODE_REFERENCE_ARGS 8
> // The maximal argument count for OF node reference
> #define MAX_PHANDLE_ARGS 16
>
> But of_fwnode_get_reference_args() directly assigns OF node
> reference argument count @of_args.args_count to frimware

firmware

> @args->nargs, and may cause firmware node reference argument
> count @of_args.args_count got out of range, namely, in [9, 16].
>
> Fix by increasing NR_FWNODE_REFERENCE_ARGS to 16 to meet OF requirement.

--
With Best Regards,
Andy Shevchenko