From: Even Xu <even.xu@intel.com>
To: dan.carpenter@linaro.org
Cc: srinivas.pandruvada@linux.intel.com, jikos@kernel.org,
bentiss@kernel.org, mpearson-lenovo@squebb.ca,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org, Even Xu <even.xu@intel.com>
Subject: [PATCH next] HID: intel-thc-hid: intel-quicki2c: fix potential memory corruption
Date: Mon, 13 Jan 2025 16:50:47 +0800 [thread overview]
Message-ID: <20250113085047.2100403-1-even.xu@intel.com> (raw)
Use U32 to get value from ACPI and explicitly cast to U16.
fixes: 5282e45ccbfa ("HID: intel-thc-hid: intel-quicki2c: Add THC QuickI2C ACPI interfaces")
Signed-off-by: Even Xu <even.xu@intel.com>
---
drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c b/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
index b56c72124821..2de93f4a25ca 100644
--- a/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
+++ b/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
@@ -118,6 +118,7 @@ static int quicki2c_get_acpi_resources(struct quicki2c_device *qcdev)
struct acpi_device *adev = ACPI_COMPANION(qcdev->dev);
struct quicki2c_subip_acpi_parameter i2c_param;
struct quicki2c_subip_acpi_config i2c_config;
+ u32 hid_desc_addr;
int ret = -EINVAL;
if (!adev) {
@@ -131,10 +132,12 @@ static int quicki2c_get_acpi_resources(struct quicki2c_device *qcdev)
QUICKI2C_ACPI_REVISION_NUM,
QUICKI2C_ACPI_FUNC_NUM_HID_DESC_ADDR,
ACPI_TYPE_INTEGER,
- &qcdev->hid_desc_addr);
+ &hid_desc_addr);
if (ret)
return ret;
+ qcdev->hid_desc_addr = (u16)hid_desc_addr;
+
ret = quicki2c_acpi_get_dsm_property(adev, &thc_platform_guid,
QUICKI2C_ACPI_REVISION_NUM,
QUICKI2C_ACPI_FUNC_NUM_ACTIVE_LTR_VAL,
--
2.40.1
next reply other threads:[~2025-01-13 8:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-13 8:50 Even Xu [this message]
2025-01-13 10:08 ` Benjamin Tissoires
2025-01-14 0:14 ` Xu, Even
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=20250113085047.2100403-1-even.xu@intel.com \
--to=even.xu@intel.com \
--cc=bentiss@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=jikos@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpearson-lenovo@squebb.ca \
--cc=srinivas.pandruvada@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
all inboxes | Powered by JetHome®