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: <d33b97aecfe09cab31ebf06de3e02b633314ae9d.camel@intel.com>
Date: Mon, 25 Mar 2024 12:24:15 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>
CC: "tglx@...utronix.de" <tglx@...utronix.de>, "jgross@...e.com"
	<jgross@...e.com>, "x86@...nel.org" <x86@...nel.org>, "bp@...en8.de"
	<bp@...en8.de>
Subject: Re: [PATCH 1/4] x86/cpu: Add and use new CPUID region helper


Nit:

> +
> +/* Returns true if the leaf exists and @value was populated */

						 ^ is ?

> +static inline bool get_cpuid_region_leaf(u32 leaf, enum cpuid_regs_idx reg,
> +					 u32 *value)
> +{
> +	u16 region = leaf >> 16;
> +	u32 regs[4];
> +
> +	if (cpuid_region_max_leaf(region) < leaf)
> +		return false;
> +
> +	cpuid(leaf, &regs[CPUID_EAX], &regs[CPUID_EBX],
> +	            &regs[CPUID_ECX], &regs[CPUID_EDX]);
> +
> +	*value = regs[reg];
> +
> +	return true;
> +}

I found despite the get_cpuid_region_leaf() returns true/false, the return value
is never used in this series.  Instead, this series uses below pattern:

	u32 data = 0; 	/* explicit initialization */

	get_cpuid_region_leaf(leaf, ..., &data);

Which kinda implies the 'data' won't be touched if the requested leaf isn't
supported I suppose?

Since the return value is never used, should we consider just making this
function void?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ