From: Dan Carpenter <dan.carpenter@linaro.org>
To: Even Xu <even.xu@intel.com>
Cc: linux-input@vger.kernel.org
Subject: [bug report] HID: intel-thc-hid: intel-quicki2c: Add THC QuickI2C ACPI interfaces
Date: Mon, 13 Jan 2025 09:15:33 +0300 [thread overview]
Message-ID: <fa15885b-4560-4b96-b103-ca40c338f103@stanley.mountain> (raw)
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
next reply other threads:[~2025-01-13 6:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-13 6:15 Dan Carpenter [this message]
2025-01-13 6:57 ` [bug report] HID: intel-thc-hid: intel-quicki2c: Add THC QuickI2C ACPI interfaces 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=fa15885b-4560-4b96-b103-ca40c338f103@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=even.xu@intel.com \
--cc=linux-input@vger.kernel.org \
/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