From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: rjingar <rajvi.jingar@linux.intel.com>,
Hans de Goede <hdegoede@redhat.com>
Cc: irenic.rajneesh@gmail.com, david.e.box@intel.com,
markgross@kernel.org, platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] platform/x86/intel/pmc: Fix hang in pmc_core_send_ltr_ignore()
Date: Mon, 18 Dec 2023 14:30:04 +0200 (EET) [thread overview]
Message-ID: <5bf1ca2-92e2-25bb-10fa-59db2ed5839@linux.intel.com> (raw)
In-Reply-To: <20231216011650.1973941-1-rajvi.jingar@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1539 bytes --]
On Fri, 15 Dec 2023, rjingar wrote:
> From: Rajvi Jingar <rajvi.jingar@linux.intel.com>
>
> For input value 0, PMC stays unassigned which causes crash while trying
> to access PMC for register read/write. Include LTR index 0 in pmc_index
> and ltr_index calculation.
>
> Fixes: 2bcef4529222 ("platform/x86:intel/pmc: Enable debugfs multiple PMC support")
> Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
> ---
> drivers/platform/x86/intel/pmc/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c
> index 983e3a8f4910..55eb6a4683fb 100644
> --- a/drivers/platform/x86/intel/pmc/core.c
> +++ b/drivers/platform/x86/intel/pmc/core.c
> @@ -474,7 +474,7 @@ int pmc_core_send_ltr_ignore(struct pmc_dev *pmcdev, u32 value)
> * is based on the contiguous indexes from ltr_show output.
> * pmc index and ltr index needs to be calculated from it.
> */
> - for (pmc_index = 0; pmc_index < ARRAY_SIZE(pmcdev->pmcs) && ltr_index > 0; pmc_index++) {
> + for (pmc_index = 0; pmc_index < ARRAY_SIZE(pmcdev->pmcs) && ltr_index >= 0; pmc_index++) {
> pmc = pmcdev->pmcs[pmc_index];
>
> if (!pmc)
>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
I'll have to say though I really don't like they way that function is
playing with fire by mixing the use of signed and unsigned variables.
As is, this can only be triggered through a debugfs write and we're
already in -rc6 so IMO next material.
--
i.
next prev parent reply other threads:[~2023-12-18 12:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-16 1:16 [PATCH 1/2] platform/x86/intel/pmc: Fix hang in pmc_core_send_ltr_ignore() rjingar
2023-12-18 12:30 ` Ilpo Järvinen [this message]
2023-12-18 13:10 ` Ilpo Järvinen
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=5bf1ca2-92e2-25bb-10fa-59db2ed5839@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=david.e.box@intel.com \
--cc=hdegoede@redhat.com \
--cc=irenic.rajneesh@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rajvi.jingar@linux.intel.com \
/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