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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YHXT4kIrs28daRER@zen>
Date:   Tue, 13 Apr 2021 10:25:01 -0700
From:   Boris Burkov <boris@....io>
To:     Khaled ROMDHANI <khaledromdhani216@...il.com>
Cc:     clm@...com, josef@...icpanda.com, dsterba@...e.com,
        linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH-next] fs/btrfs: Fix uninitialized variable

On Tue, Apr 13, 2021 at 02:06:04PM +0100, Khaled ROMDHANI wrote:
> The variable zone is not initialized. It
> may causes a failed assertion.
> 
> Addresses-Coverity: ("Uninitialized variables")
> 
> Signed-off-by: Khaled ROMDHANI <khaledromdhani216@...il.com>

Reviewed-by: Boris Burkov <boris@....io>

> ---
>  fs/btrfs/zoned.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
> index eeb3ebe11d7a..ee15ab8dccb5 100644
> --- a/fs/btrfs/zoned.c
> +++ b/fs/btrfs/zoned.c
> @@ -136,7 +136,7 @@ static int sb_write_pointer(struct block_device *bdev, struct blk_zone *zones,
>   */
>  static inline u32 sb_zone_number(int shift, int mirror)
>  {
> -	u64 zone;
> +	u64 zone = 0;
>  
>  	ASSERT(mirror < BTRFS_SUPER_MIRROR_MAX);

Thanks for the fix.

I assume this was dug up by coverity static analysis rather than hitting
it in a live system?

Since there is already an assert for the pre-condition 'mirror < max',
I feel like it would make sense to also add one for mirror > 0.

>  	switch (mirror) {
> -- 
> 2.17.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ