From: Andrew Lunn <andrew@lunn.ch>
To: Kory Maincent <kory.maincent@bootlin.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
Oleksij Rempel <o.rempel@pengutronix.de>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
thomas.petazzoni@bootlin.com, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH net] net: pse-pd: pd692x0: Fix power limit retrieval
Date: Mon, 17 Feb 2025 16:24:44 +0100 [thread overview]
Message-ID: <bb058f5f-31f2-4c20-848e-54c178ecaf6c@lunn.ch> (raw)
In-Reply-To: <20250217134812.1925345-1-kory.maincent@bootlin.com>
On Mon, Feb 17, 2025 at 02:48:11PM +0100, Kory Maincent wrote:
> Fix incorrect data offset read in the pd692x0_pi_get_pw_limit callback.
> The issue was previously unnoticed as it was only used by the regulator
> API and not thoroughly tested, since the PSE is mainly controlled via
> ethtool.
>
> The function became actively used by ethtool after commit 3e9dbfec4998
> ("net: pse-pd: Split ethtool_get_status into multiple callbacks"),
> which led to the discovery of this issue.
>
> Fix it by using the correct data offset.
>
> Fixes: a87e699c9d33 ("net: pse-pd: pd692x0: Enhance with new current limit and voltage read callbacks")
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> ---
> drivers/net/pse-pd/pd692x0.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/pse-pd/pd692x0.c b/drivers/net/pse-pd/pd692x0.c
> index fc9e23927b3b..7d60a714ca53 100644
> --- a/drivers/net/pse-pd/pd692x0.c
> +++ b/drivers/net/pse-pd/pd692x0.c
> @@ -1047,7 +1047,7 @@ static int pd692x0_pi_get_pw_limit(struct pse_controller_dev *pcdev,
> if (ret < 0)
> return ret;
>
> - return pd692x0_pi_get_pw_from_table(buf.data[2], buf.data[3]);
> + return pd692x0_pi_get_pw_from_table(buf.data[0], buf.data[1]);
Would the issue of been more obvious if some #defines were used,
rather than magic numbers?
Andrew
next prev parent reply other threads:[~2025-02-17 15:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-17 13:48 Kory Maincent
2025-02-17 15:24 ` Andrew Lunn [this message]
2025-02-17 16:15 ` Kory Maincent
2025-02-19 2:33 ` Jakub Kicinski
2025-02-19 2:40 ` patchwork-bot+netdevbpf
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=bb058f5f-31f2-4c20-848e-54c178ecaf6c@lunn.ch \
--to=andrew@lunn.ch \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kory.maincent@bootlin.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=pabeni@redhat.com \
--cc=thomas.petazzoni@bootlin.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
all inboxes | Powered by JetHome®