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: <ZRXoXLV69TQ7Wvkr@gmail.com>
Date:   Thu, 28 Sep 2023 22:55:56 +0200
From:   Ingo Molnar <mingo@...nel.org>
To:     "Compostella, Jeremy" <jeremy.compostella@...el.com>
Cc:     linux-kernel@...r.kernel.org, x86@...nel.org
Subject: Re: [PATCH v2 2/2] x86/cpu/intel: Clean-up TME code


* Compostella, Jeremy <jeremy.compostella@...el.com> wrote:

> -/* Values for mktme_status (SW only construct) */
> -#define MKTME_ENABLED			0
> -#define MKTME_DISABLED			1
> -#define MKTME_UNINITIALIZED		2
> -static int mktme_status = MKTME_UNINITIALIZED;
> -
>  static void detect_tme(struct cpuinfo_x86 *c)
>  {
>  	u64 tme_activate, tme_policy, tme_crypto_algs;
>  	int keyid_bits = 0, nr_keyids = 0;
>  	static u64 tme_activate_cpu0 = 0;
> +	static enum {
> +		MKTME_ENABLED,
> +		MKTME_DISABLED,
> +		MKTME_UNINITIALIZED
> +	} mktme_status = MKTME_UNINITIALIZED;

Please don't move the new enum inside the function, even if
that's the only place it's used.

We almost always keep constant definitions outside function scope.

We also try to avoid static variables inside functions.

Thanks,

	Ingo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ