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: <20210430140128.GA2565@ard0534>
Date:   Fri, 30 Apr 2021 15:01:28 +0100
From:   Khaled Romdhani <khaledromdhani216@...il.com>
To:     Dan Carpenter <dan.carpenter@...cle.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-V2] fs/btrfs: Fix uninitialized variable

On Thu, Apr 29, 2021 at 05:12:00PM +0300, Dan Carpenter wrote:
> On Tue, Apr 27, 2021 at 06:16:27PM +0100, Khaled ROMDHANI wrote:
> > The variable 'zone' is uninitialized which
> > introduce some build warning.
> > 
> > Reported-by: kernel test robot <lkp@...el.com>
> > Signed-off-by: Khaled ROMDHANI <khaledromdhani216@...il.com>
> > ---
> > v2: catch the init as an assertion
> > ---
> >  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 432509f4b3ac..70c0b1b2ff04 100644
> > --- a/fs/btrfs/zoned.c
> > +++ b/fs/btrfs/zoned.c
> > @@ -144,7 +144,7 @@ static inline u32 sb_zone_number(int shift, int mirror)
> >  	case 1: zone = 1ULL << (BTRFS_SB_LOG_FIRST_SHIFT - shift); break;
> >  	case 2: zone = 1ULL << (BTRFS_SB_LOG_SECOND_SHIFT - shift); break;
> >  	default:
> > -		ASSERT(zone);
> > +		ASSERT(zone = 0);
> 
> I'm sorry but this doesn't make any kind of sense.
> 
> >  		break;
> >  	}
> 
> regards,
> dan carpenter
>

The idea behind this is to force the assertion failure 
in default when no valid 'mirror' value was entered.
But as all caller pass valid mirror values, this case 
will not happen. So, I just fix the warning of the uninitialized 
variable 'zone' as reported by the kernel test robot. 
Thus I guarantee the failure when 'mirror' was invalid.

If I am wrong, please clarify.

Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ