public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: <tony.luck@intel.com>, <james.morse@arm.com>,
	<Dave.Martin@arm.com>, <babu.moger@amd.com>, <bp@alien8.de>,
	<tglx@linutronix.de>, <dave.hansen@linux.intel.com>
Cc: <x86@kernel.org>, <hpa@zytor.com>, <ben.horgan@arm.com>,
	<fustini@kernel.org>, <fenghuay@nvidia.com>,
	<peternewman@google.com>, <linux-kernel@vger.kernel.org>,
	<patches@lists.linux.dev>
Subject: Re: [PATCH v3 05/13] x86/resctrl: Protect against bad shift
Date: Wed, 8 Apr 2026 09:37:31 -0700	[thread overview]
Message-ID: <70687d1d-a373-4196-b59b-ef7baf337942@intel.com> (raw)
In-Reply-To: <280c162f8b935d6c755027aa382d55e84ba31116.1775576382.git.reinette.chatre@intel.com>



On 4/7/26 9:02 AM, Reinette Chatre wrote:
> diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
> index 7667cf7c4e94..db787c4dee61 100644
> --- a/arch/x86/kernel/cpu/resctrl/core.c
> +++ b/arch/x86/kernel/cpu/resctrl/core.c
> @@ -246,7 +246,9 @@ static __init bool __rdt_get_mem_config_amd(struct rdt_resource *r)
>  
>  	cpuid_count(0x80000020, subleaf, &eax, &ebx, &ecx, &edx);
>  	hw_res->num_closid = edx + 1;
> -	r->membw.max_bw = 1 << eax;
> +	if (WARN_ON(BITS_PER_TYPE(r->membw.max_bw) <= eax))

sashiko [1] reminded me about not using WARN_ON().
I'll switch this to pr_warn(). 

> +		return false;
> +	r->membw.max_bw = BIT(eax);
>  

Reinette

[1] https://sashiko.dev/#/patchset/cover.1775576382.git.reinette.chatre%40intel.com





  reply	other threads:[~2026-04-08 16:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07 16:01 [PATCH v3 00/13] x86,fs/resctrl: Improve resctrl quality and consistency Reinette Chatre
2026-04-07 16:01 ` [PATCH v3 01/13] MAINTAINERS: Update resctrl entry Reinette Chatre
2026-04-07 16:01 ` [PATCH v3 02/13] fs/resctrl: Add missing return value descriptions Reinette Chatre
2026-04-07 16:02 ` [PATCH v3 03/13] fs/resctrl: Avoid "may be used uninitialized" warning Reinette Chatre
2026-04-07 18:55   ` Borislav Petkov
2026-04-07 20:50     ` Reinette Chatre
2026-04-07 22:19       ` Borislav Petkov
2026-04-07 22:56         ` Reinette Chatre
2026-04-07 16:02 ` [PATCH v3 04/13] fs/resctrl: Use correct format specifier for printing error pointers Reinette Chatre
2026-04-07 16:02 ` [PATCH v3 05/13] x86/resctrl: Protect against bad shift Reinette Chatre
2026-04-08 16:37   ` Reinette Chatre [this message]
2026-04-07 16:02 ` [PATCH v3 06/13] fs/resctrl: Change pattern used to track number of entries in enum Reinette Chatre
2026-04-07 16:02 ` [PATCH v3 07/13] fs/resctrl: Use accurate type for rdt_resource::rid Reinette Chatre
2026-04-07 16:02 ` [PATCH v3 08/13] fs/resctrl: Pass error reading event through to user space Reinette Chatre
2026-04-07 16:02 ` [PATCH v3 09/13] fs/resctrl: Add last_cmd_status support for writes to max_threshold_occupancy Reinette Chatre
2026-04-07 16:02 ` [PATCH v3 10/13] fs/resctrl: Use accurate and symmetric exit flows Reinette Chatre
2026-04-07 16:02 ` [PATCH v3 11/13] fs/resctrl: Change last_cmd_status custom during input parsing Reinette Chatre
2026-04-07 16:02 ` [PATCH v3 12/13] fs/resctrl: Communicate resource group deleted error via last_cmd_status Reinette Chatre
2026-04-07 16:02 ` [PATCH v3 13/13] fs/resctrl: Inform user space when status buffer overflowed Reinette Chatre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=70687d1d-a373-4196-b59b-ef7baf337942@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=Dave.Martin@arm.com \
    --cc=babu.moger@amd.com \
    --cc=ben.horgan@arm.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=fenghuay@nvidia.com \
    --cc=fustini@kernel.org \
    --cc=hpa@zytor.com \
    --cc=james.morse@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=peternewman@google.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox