lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <924dbf67-9973-4f06-9945-05533df35cf4@lunn.ch>
Date: Sun, 16 Nov 2025 17:17:12 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Mietek N <namiltd@...oo.com>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"linus.walleij@...aro.org" <linus.walleij@...aro.org>,
	"alsi@...g-olufsen.dk" <alsi@...g-olufsen.dk>,
	"olteanv@...il.com" <olteanv@...il.com>,
	"davem@...emloft.net" <davem@...emloft.net>,
	"edumazet@...gle.com" <edumazet@...gle.com>,
	"kuba@...nel.org" <kuba@...nel.org>,
	"pabeni@...hat.com" <pabeni@...hat.com>
Subject: Re: [PATCH] rtl8365mb: initialize ret in phy_ocp_read and return ret
 in phy_ocp_write

On Sun, Nov 16, 2025 at 03:29:45PM +0000, Mietek N wrote:
> This patch fixes two issues in the RTL8365MB driver:
> 
>  - Initialize the 'ret' variable in rtl8365mb_phy_ocp_read() to 0 to avoid
>    using an uninitialized automatic variable on some execution paths.
>  - Propagate the return value from rtl8365mb_phy_ocp_write() by returning
>    'ret' instead of always returning 0, so write failures are not silently
>    ignored.
> 
> No other changes are made and the PHY OCP helper functions themselves
> remain functionally identical except for the corrected return behaviour.
> 
> Signed-off-by: Mieczyslaw Nalewaj <namiltd@...oo.com>
> 
> ---
>  drivers/net/dsa/realtek/rtl8365mb.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff -ruN a/drivers/net/dsa/realtek/rtl8365mb.c b/drivers/net/dsa/realtek/rtl8365mb.c
> --- a/drivers/net/dsa/realtek/rtl8365mb.c    2025-10-12 22:42:36.000000000 +0200
> +++ b/drivers/net/dsa/realtek/rtl8365mb.c    2025-11-16 14:02:57.000000000 +0100
> @@ -690,7 +690,7 @@
>                    u32 ocp_addr, u16 *data)
>  {
>      u32 val;
> -    int ret;
> +    int ret = 0;
>  
>      rtl83xx_lock(priv);
>  


You diff is a bit odd, normally the name of the function is in the
header. But the commit message says this is rtl8365mb_phy_ocp_read()

static int rtl8365mb_phy_ocp_read(struct realtek_priv *priv, int phy,
				  u32 ocp_addr, u16 *data)
{
	u32 val;
	int ret;

	rtl83xx_lock(priv);

	ret = rtl8365mb_phy_poll_busy(priv);
	if (ret)
		goto out;

ret has been assigned a value, before the goto. So all execution paths
have a valid ret value.

Am i missing something?

    Andrew

---
pw-bot: cr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ