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: <20250305225057.GBZ8jVUXJmIJBZwdgT@fat_crate.local>
Date: Wed, 5 Mar 2025 23:50:57 +0100
From: Borislav Petkov <bp@...en8.de>
To: Arnd Bergmann <arnd@...db.de>
Cc: Ingo Molnar <mingo@...nel.org>, Arnd Bergmann <arnd@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
	Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>,
	Rick Edgecombe <rick.p.edgecombe@...el.com>,
	"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
	Tom Lendacky <thomas.lendacky@....com>,
	"H. Peter Anvin" <hpa@...or.com>,
	"Jason A . Donenfeld" <Jason@...c4.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86: coco: mark cc_mask as __maybe_unused

On Wed, Mar 05, 2025 at 11:45:11PM +0100, Arnd Bergmann wrote:
> There is a twist here: clang by default warns about unused const
> variables in .c files but not in headers, while gcc doesn't

What is the point of this warning, do you know?

Someone defines a const, forgets to use it and? Oh big deal. This should be
a -Wunused anyway, no?

I must be missing something here...

> warn about them at all unless it's explictly enabled, and then
> it warns about both of them. Newer gcc versions have a distinct
> -Wunused-const-variable=1 for the clang behavior and
> -Wunused-const-variable=2 that warns for both, so we could
> reasonably decide to enable the =1 version by default and
> leave the =2 version for W=2.
> 
> On the other hand, most of the users of 'static const' variables
> in headers are rather dumb and should just be moved into the
> file that uses them, or they can be replaced with a #define
> or an enum.
> 
> In this case, the only user is a macro:
> #define _PAGE_CC               (_AT(pteval_t, cc_mask))
> 
> so maybe '#define cc_mask 0' would be appropriate.

Sounds a lot better to me.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ