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: <22cd0fa8-d14d-4d37-a6a1-5e6827d6182b@intel.com>
Date: Tue, 10 Jun 2025 07:55:36 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Em Sharnoff <sharnoff@...n.tech>, linux-kernel@...r.kernel.org,
 x86@...nel.org, linux-mm@...ck.org
Cc: Ingo Molnar <mingo@...nel.org>, "H. Peter Anvin" <hpa@...or.com>,
 Dave Hansen <dave.hansen@...ux.intel.com>, Andy Lutomirski
 <luto@...nel.org>, Peter Zijlstra <peterz@...radead.org>,
 Thomas Gleixner <tglx@...utronix.de>, Borislav Petkov <bp@...en8.de>,
 "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>,
 Oleg Vasilev <oleg@...n.tech>, Arthur Petukhovsky <arthur@...n.tech>,
 Stefan Radig <stefan@...n.tech>, Misha Sakhnov <misha@...n.tech>
Subject: Re: [PATCH v3 1/2] x86/mm: Handle alloc failure in phys_*_init()

On 6/10/25 03:16, Em Sharnoff wrote:
> +		if (!pmd)
> +			return (unsigned long)ERR_PTR(-ENOMEM);

All of this casting isn't great to look at. Just about every line of
code that this patch touches also introduces has a cast.

Could you please find a way to reduce the number of casts?

> +		/*
> +		 * We might have IS_ERR(paddr_last) if allocation failed, but we should
> +		 * still update pud before bailing, so that subsequent retries can pick
> +		 * up on progress (here and in phys_pmd_init) without leaking pmd.
> +		 */

Please write everything in imperative voice. No "we's", please.

> -	for (i = 0; i < nr_range; i++)
> +	for (i = 0; i < nr_range; i++) {
>  		ret = kernel_physical_mapping_init(mr[i].start, mr[i].end,
>  						   mr[i].page_size_mask,
>  						   prot);
> +		if (IS_ERR((void *)ret))
> +			return ret;
> +	}

Are there any _actual_ users of 'paddr_last'? I see a lot of setting it
and passing it around, but I _think_ this is the only place it actually
gets used. Here, the fact that it's an address doesn't even matter.



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ