All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shuai Xue <xueshuai@linux.alibaba.com>
To: rafael@kernel.org, tony.luck@intel.com, bp@alien8.de
Cc: lenb@kernel.org, james.morse@arm.com, jaylu102@amd.com,
	benjamin.cheatham@amd.com, dan.j.williams@intel.com,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	baolin.wang@linux.alibaba.com, xueshuai@linux.alibaba.com,
	zhuo.song@linux.alibaba.com
Subject: [PATCH] ACPI: APEI: EINJ: Limit error type to 32-bit width
Date: Wed, 18 Jan 2023 14:35:04 +0800	[thread overview]
Message-ID: <20230118063504.58026-1-xueshuai@linux.alibaba.com> (raw)

The bit map of error types to inject is 32-bit width[1]. Add parameter
check to reflect the fact.

[1] ACPI Specification 6.4, Section 18.6.4. Error Types

Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com>
---
 drivers/acpi/apei/einj.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index ab86b2f4e719..b4373e575660 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -616,6 +616,10 @@ static int error_type_set(void *data, u64 val)
 	u32 available_error_type = 0;
 	u32 tval, vendor;
 
+	/* Only low 32 bits for error type are valid */
+	if (val & GENMASK_ULL(63, 32))
+		return -EINVAL;
+
 	/*
 	 * Vendor defined types have 0x80000000 bit set, and
 	 * are not enumerated by ACPI_EINJ_GET_ERROR_TYPE
-- 
2.20.1.12.g72788fdb


             reply	other threads:[~2023-01-18  7:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18  6:35 Shuai Xue [this message]
2023-01-18 16:37 ` [PATCH] ACPI: APEI: EINJ: Limit error type to 32-bit width Luck, Tony
2023-01-19  2:10   ` Shuai Xue
2023-01-30 15:41     ` Rafael J. Wysocki
2023-01-31  1:57       ` Shuai Xue

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=20230118063504.58026-1-xueshuai@linux.alibaba.com \
    --to=xueshuai@linux.alibaba.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=benjamin.cheatham@amd.com \
    --cc=bp@alien8.de \
    --cc=dan.j.williams@intel.com \
    --cc=james.morse@arm.com \
    --cc=jaylu102@amd.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=tony.luck@intel.com \
    --cc=zhuo.song@linux.alibaba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.