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: <b5526175-e0fd-49fc-a899-4920aa0f595e@intel.com>
Date: Mon, 31 Mar 2025 12:16:11 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Chao Gao <chao.gao@...el.com>, "Chang S. Bae" <chang.seok.bae@...el.com>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org, tglx@...utronix.de,
 mingo@...hat.com, bp@...en8.de, dave.hansen@...ux.intel.com,
 colinmitchell@...gle.com
Subject: Re: [PATCH v2 5/6] x86/microcode/intel: Support mailbox transfer

On 3/26/25 20:32, Chao Gao wrote:
> static enum ucode_state wait_for_transaction(void)
> {
> 	u32 timeout, status;
> 
> 	/* Allow time for hardware to complete the operation: */
> 	for (timeout = 0; timeout < MBOX_XACTION_TIMEOUT_MS; timeout++) {
> 		msleep(1);
> 
> 		status = readl(staging.mmio_base + MBOX_STATUS_OFFSET);
> 
> 		if (status & MASK_MBOX_STATUS_READY)
> 			return UCODE_OK;
> 
> 		/* Check for explicit error response */
> 		if (status & MASK_MBOX_STATUS_ERROR)
> 			return UCODE_ERROR;
> 	}
> 
> 	/*
> 	 * Hardware is neither responded to the action nor
> 	 * signaled any error. Treat the case as timeout.
> 	 */
> 	return UCODE_TIMEOUT;
> }

The flow at minimal indent in the function should be the _main_ control
flow: the common case.

The common case here is the "return UCODE_OK". It should not be buried
in a for() loop. I kinda like what Chang had before.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ