mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH next] HID: intel-thc-hid: intel-quicki2c: fix potential memory corruption
@ 2025-01-13  8:50 Even Xu
  2025-01-13 10:08 ` Benjamin Tissoires
  0 siblings, 1 reply; 3+ messages in thread
From: Even Xu @ 2025-01-13  8:50 UTC (permalink / raw)
  To: dan.carpenter
  Cc: srinivas.pandruvada, jikos, bentiss, mpearson-lenovo,
	linux-input, linux-kernel, kernel-janitors, Even Xu

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH next] HID: intel-thc-hid: intel-quicki2c: fix potential memory corruption
  2025-01-13  8:50 [PATCH next] HID: intel-thc-hid: intel-quicki2c: fix potential memory corruption Even Xu
@ 2025-01-13 10:08 ` Benjamin Tissoires
  2025-01-14  0:14   ` Xu, Even
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Tissoires @ 2025-01-13 10:08 UTC (permalink / raw)
  To: dan.carpenter, Even Xu
  Cc: srinivas.pandruvada, jikos, mpearson-lenovo, linux-input,
	linux-kernel, kernel-janitors

On Mon, 13 Jan 2025 16:50:47 +0800, Even Xu wrote:
> Use U32 to get value from ACPI and explicitly cast to U16.
> 
> 

Applied to hid/hid.git (for-6.14/intel-thc), thanks!

[1/1] HID: intel-thc-hid: intel-quicki2c: fix potential memory corruption
      https://git.kernel.org/hid/hid/c/d08a1049659a

Cheers,
-- 
Benjamin Tissoires <bentiss@kernel.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH next] HID: intel-thc-hid: intel-quicki2c: fix potential memory corruption
  2025-01-13 10:08 ` Benjamin Tissoires
@ 2025-01-14  0:14   ` Xu, Even
  0 siblings, 0 replies; 3+ messages in thread
From: Xu, Even @ 2025-01-14  0:14 UTC (permalink / raw)
  To: Benjamin Tissoires, dan.carpenter
  Cc: srinivas.pandruvada, jikos, mpearson-lenovo, linux-input,
	linux-kernel, kernel-janitors

Thanks Benjamin!

Best Regards,
Even Xu

> -----Original Message-----
> From: Benjamin Tissoires <bentiss@kernel.org>
> Sent: Monday, January 13, 2025 6:09 PM
> To: dan.carpenter@linaro.org; Xu, Even <even.xu@intel.com>
> Cc: srinivas.pandruvada@linux.intel.com; jikos@kernel.org; mpearson-
> lenovo@squebb.ca; linux-input@vger.kernel.org; linux-kernel@vger.kernel.org;
> kernel-janitors@vger.kernel.org
> Subject: Re: [PATCH next] HID: intel-thc-hid: intel-quicki2c: fix potential memory
> corruption
> 
> On Mon, 13 Jan 2025 16:50:47 +0800, Even Xu wrote:
> > Use U32 to get value from ACPI and explicitly cast to U16.
> >
> >
> 
> Applied to hid/hid.git (for-6.14/intel-thc), thanks!
> 
> [1/1] HID: intel-thc-hid: intel-quicki2c: fix potential memory corruption
>       https://git.kernel.org/hid/hid/c/d08a1049659a
> 
> Cheers,
> --
> Benjamin Tissoires <bentiss@kernel.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-14  0:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-13  8:50 [PATCH next] HID: intel-thc-hid: intel-quicki2c: fix potential memory corruption Even Xu
2025-01-13 10:08 ` Benjamin Tissoires
2025-01-14  0:14   ` Xu, Even

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®