RE: [bug report] HID: intel-thc-hid: intel-quicki2c: Add THC QuickI2C ACPI interfaces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Dan!
Will create a patch for the fix soon.

Best Regards,
Even Xu

> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Sent: Monday, January 13, 2025 2:16 PM
> To: Xu, Even <even.xu@xxxxxxxxx>
> Cc: linux-input@xxxxxxxxxxxxxxx
> Subject: [bug report] HID: intel-thc-hid: intel-quicki2c: Add THC QuickI2C ACPI
> interfaces
> 
> Hello Even Xu,
> 
> Commit 5282e45ccbfa ("HID: intel-thc-hid: intel-quicki2c: Add THC QuickI2C ACPI
> interfaces") from Jan 6, 2025 (linux-next), leads to the following Smatch static
> checker warning:
> 
> 	drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c:59
> quicki2c_acpi_get_dsm_property()
> 	warn: potential memory corrupting cast 4 vs 2 bytes
> 
> drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
>    116  static int quicki2c_get_acpi_resources(struct quicki2c_device *qcdev)
>    117  {
>    118          struct acpi_device *adev = ACPI_COMPANION(qcdev->dev);
>    119          struct quicki2c_subip_acpi_parameter i2c_param;
>    120          struct quicki2c_subip_acpi_config i2c_config;
>    121          int ret = -EINVAL;
>    122
>    123          if (!adev) {
>    124                  dev_err(qcdev->dev, "Invalid acpi device pointer\n");
>    125                  return ret;
>    126          }
>    127
>    128          qcdev->acpi_dev = adev;
>    129
>    130          ret = quicki2c_acpi_get_dsm_property(adev, &i2c_hid_guid,
>    131                                               QUICKI2C_ACPI_REVISION_NUM,
>    132                                               QUICKI2C_ACPI_FUNC_NUM_HID_DESC_ADDR,
>    133                                               ACPI_TYPE_INTEGER,
>                                                      ^^^^^^^^^^^^^^^^^ This says INTEGER
> 
>    134                                               &qcdev->hid_desc_addr);
>                                                      ^^^^^^^^^^^^^^^^^^^^^ But this is a u16 so it
> corrupts memory.
> 
>    135          if (ret)
>    136                  return ret;
>    137
> 
> regards,
> dan carpenter





[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux