From: Andrew Lunn <andrew@lunn.ch>
To: khendry@reliablecontrols.com
Cc: "Clément Léger" <clement.leger@bootlin.com>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
"Russell King" <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] net: pcs: rzn1-miic: Verify port number from dtb
Date: Tue, 1 Sep 2026 18:02:11 +0200 [thread overview]
Message-ID: <bca8ba82-211e-496c-bc8a-c9ccd8667f9c@lunn.ch> (raw)
In-Reply-To: <20260901-rzn1-miic-fix-array-v2-2-3e907049e770@reliablecontrols.com>
On Tue, Sep 01, 2026 at 08:25:14AM -0700, Kyle Hendry via B4 Relay wrote:
> From: Kyle Hendry <khendry@reliablecontrols.com>
>
> Add check to make sure port number is in range before writing
> to dt_val array
>
> Signed-off-by: Kyle Hendry <khendry@reliablecontrols.com>
> ---
> drivers/net/pcs/pcs-rzn1-miic.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-miic.c
> index c50b65d064fa..ebd73ed63896 100644
> --- a/drivers/net/pcs/pcs-rzn1-miic.c
> +++ b/drivers/net/pcs/pcs-rzn1-miic.c
> @@ -692,6 +692,11 @@ 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);
> + continue;
Better to return -EINVAL, so the probe fails and the broken DT blob is
fixed.
Andrew
---
pw-bot: cr
prev parent reply other threads:[~2026-09-01 16:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 15:25 [PATCH v2 0/2] net: pcs: rzn1-miic: Fix config array initialization Kyle Hendry via B4 Relay
2026-09-01 15:25 ` [PATCH v2 1/2] " Kyle Hendry via B4 Relay
2026-09-01 16:02 ` Andrew Lunn
2026-09-02 7:05 ` Geert Uytterhoeven
2026-09-01 15:25 ` [PATCH v2 2/2] net: pcs: rzn1-miic: Verify port number from dtb Kyle Hendry via B4 Relay
2026-09-01 16:02 ` Andrew Lunn [this message]
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=bca8ba82-211e-496c-bc8a-c9ccd8667f9c@lunn.ch \
--to=andrew@lunn.ch \
--cc=clement.leger@bootlin.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=khendry@reliablecontrols.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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