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: <20230705081516.67d0e26e@bootlin.com>
Date:   Wed, 5 Jul 2023 08:15:16 +0200
From:   Herve Codina <herve.codina@...tlin.com>
To:     Yu Hao <yhao016@....edu>
Cc:     woojung.huh@...rochip.com, UNGLinuxDriver@...rochip.com,
        davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
        pabeni@...hat.com, netdev@...r.kernel.org,
        linux-usb@...r.kernel.org,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net: lan78xx: Fix possible uninit bug

On Tue, 4 Jul 2023 18:15:09 -0700
Yu Hao <yhao016@....edu> wrote:

> The variable buf should be initialized in the function lan78xx_read_reg.
> However, there is no return value check, which means the variable buf
> could still be uninit. But there is a read later.
> 
> Signed-off-by: Yu Hao <yhao016@....edu>
> ---
>  drivers/net/usb/lan78xx.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
> index c458c030fadf..4c9318c92fe6 100644
> --- a/drivers/net/usb/lan78xx.c
> +++ b/drivers/net/usb/lan78xx.c
> @@ -1091,8 +1091,11 @@ static int lan78xx_write_raw_otp(struct
> lan78xx_net *dev, u32 offset,
>     int i;
>     u32 buf;
>     unsigned long timeout;
> +   int ret;
> 
> -   lan78xx_read_reg(dev, OTP_PWR_DN, &buf);
> +   ret = lan78xx_read_reg(dev, OTP_PWR_DN, &buf);
> +   if (ret < 0)
> +       return ret;
> 
>     if (buf & OTP_PWR_DN_PWRDN_N_) {
>         /* clear it and wait to be cleared */

Reviewed-by: Herve Codina <herve.codina@...tlin.com>

Best regards,
Hervé

-- 
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ