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: <20190129154212.GO2900@twin.jikos.cz>
Date:   Tue, 29 Jan 2019 16:42:13 +0100
From:   David Sterba <dsterba@...e.cz>
To:     dsterba@...e.cz, Anders Roxell <anders.roxell@...aro.org>,
        clm@...com, josef@...icpanda.com, dsterba@...e.com,
        linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] btrfs: relocation: fix unused variable

On Tue, Jan 29, 2019 at 04:21:27PM +0100, David Sterba wrote:
> On Tue, Jan 29, 2019 at 02:01:46PM +0100, Anders Roxell wrote:
> > When CONFIG_BRTFS_ASSERT isn't enabled, variable root_objectid isn't used.
> > 
> > fs/btrfs/relocation.c: In function ‘insert_dirty_subv’:
> > fs/btrfs/relocation.c:2138:6: warning: unused variable ‘root_objectid’ [-Wunused-variable]
> >   u64 root_objectid = root->root_key.objectid;
> >       ^~~~~~~~~~~~~
> > 
> > Reworked by adding a runtime check in the assfail function instead of
> > the '#ifdef CONFIG_BTRFS_ASSERT #else ...", so the compiler sees the
> > condition being passed into an inline function after preprocessing.
> 
> I've fixed the warning by avoiding the local variable but I like your
> fix in general, thanks.

Committed with this changelog:

"btrfs: let the assertion expression compile in all configs

 A compiler warning (in a patch in development) pointed to a variable
 that was used only inside and ASSERT:

   u64 root_objectid = root->root_key.objectid;
   ASSERT(root_objectid == ...);

   fs/btrfs/relocation.c: In function ‘insert_dirty_subv’:
   fs/btrfs/relocation.c:2138:6: warning: unused variable ‘root_objectid’ [-Wunused-variable]
     u64 root_objectid = root->root_key.objectid;
	 ^~~~~~~~~~~~~

 When CONFIG_BRTFS_ASSERT isn't enabled, variable root_objectid isn't used.

 Rework the assertion helper by adding a runtime check instead of the
 '#ifdef CONFIG_BTRFS_ASSERT #else ...", so the compiler sees the
 condition being passed into an inline function after preprocessing."

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ