Re: [PATCH v3 2/2] net: pcs: rzn1-miic: Verify port number from dtb

From: Lad, Prabhakar

Date: Mon Sep 07 2026 - 15:44:18 EST


Hi Kyle,

Thank you for the patch.

On Wed, Sep 2, 2026 at 7:55 PM Kyle Hendry via B4 Relay
<devnull+khendry.reliablecontrols.com@xxxxxxxxxx> wrote:
>
> From: Kyle Hendry <khendry@xxxxxxxxxxxxxxxxxxxx>
>
> Add check to make sure port number is in range before writing
> to dt_val array
>
> Signed-off-by: Kyle Hendry <khendry@xxxxxxxxxxxxxxxxxxxx>
> ---
> drivers/net/pcs/pcs-rzn1-miic.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-miic.c
> index c50b65d064fa..3ee40eb9d545 100644
> --- a/drivers/net/pcs/pcs-rzn1-miic.c
> +++ b/drivers/net/pcs/pcs-rzn1-miic.c
> @@ -692,6 +692,12 @@ static int miic_parse_dt(struct miic *miic, u32 *mode_cfg)
> if (of_property_read_u32(conv, "reg", &port))
> continue;
>
> + if (port < miic->of_data->miic_port_start || port > miic->of_data->miic_port_max) {
> + dev_err(miic->dev, "Port number out of range: %d\n", port);
> + kfree(dt_val);
> + return -EINVAL;
> + }
> +
Query to maintainers, what policy should be followed? Since the
dtbinding check complains if the port is out of range should the code
also check it?

For the patch,
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>

Cheers,
Prabhakar

> if (of_property_read_u32(conv, "renesas,miic-input", &conf))
> continue;
>
>
> --
> 2.43.0
>
>
>