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] [day] [month] [year] [list]
Message-ID: <20220519141252.7b24d522@xps-13>
Date:   Thu, 19 May 2022 14:12:52 +0200
From:   Miquel Raynal <miquel.raynal@...tlin.com>
To:     Colin Ian King <colin.i.king@...il.com>
Cc:     Alessandro Zummo <a.zummo@...ertech.it>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Michel Pollet <michel.pollet@...renesas.com>,
        linux-rtc@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
        kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] rtc: rzn1: Fix uninitialized variable val

Hi Colin,

colin.i.king@...il.com wrote on Thu, 19 May 2022 11:06:41 +0100:

> Variable val is not being initialized and is later being read with
> a potentially garbage value. Fix this by initializing val to zero.
> 
> Detected by clang scan build:
> warning: variable 'val' is uninitialized when used here [-Wuninitialized]
> 
> Fixes: deeb4b5393e1 ("rtc: rzn1: Add new RTC driver")
> Signed-off-by: Colin Ian King <colin.i.king@...il.com>


> ---
>  drivers/rtc/rtc-rzn1.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
> index 980ade8c9601..0b4bf6e43464 100644
> --- a/drivers/rtc/rtc-rzn1.c
> +++ b/drivers/rtc/rtc-rzn1.c
> @@ -272,7 +272,7 @@ static int rzn1_rtc_set_offset(struct device *dev, long offset)
>  	struct rzn1_rtc *rtc = dev_get_drvdata(dev);
>  	unsigned int steps;
>  	int stepsh, stepsl;
> -	u32 val;
> +	u32 val = 0;

There are actually two variables mixed together. "val" is used both for
the readl_poll_timeout() call (where it should be a dedicated 'ctl2'
variable) and for the subu register which is written at the end. This
variable could be renamed 'subu' and initialized to 0 as you did.

Thanks,
Miquèl

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ