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: <20251009232200.GDaOhDmBfQVJOQjETG@fat_crate.local>
Date: Fri, 10 Oct 2025 01:22:00 +0200
From: Borislav Petkov <bp@...en8.de>
To: Babu Moger <babu.moger@....com>
Cc: tony.luck@...el.com, reinette.chatre@...el.com, Dave.Martin@....com,
	james.morse@....com, tglx@...utronix.de, mingo@...hat.com,
	dave.hansen@...ux.intel.com, x86@...nel.org, hpa@...or.com,
	linux-kernel@...r.kernel.org, peternewman@...gle.com,
	eranian@...gle.com, gautham.shenoy@....com
Subject: Re: [PATCH v3] x86/resctrl: Fix miscount of bandwidth event when
 reactivating previously Unavailable RMID

On Thu, Oct 09, 2025 at 01:29:17PM -0500, Babu Moger wrote:
> -	*val = get_corrected_val(r, d, rmid, eventid, msr_val);
> +	switch (ret) {
> +	case 0:
> +		*val = get_corrected_val(r, d, rmid, eventid, msr_val);
> +		break;
> +	case -EINVAL:
> +		am = get_arch_mbm_state(hw_dom, rmid, eventid);
> +		if (am)
> +			am->prev_msr = 0;
> +		break;
> +	default:
> +		break;
> +	}

What's the point of this switch-case?

Why is this not better?

	if (!ret)
		...
	else if (ret == -EINVAL)
		...


	return ret;

-- 
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