From: sashiko-bot@kernel.org
To: "Denis Benato" <denis.benato@linux.dev>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v11 17/18] HID: asus: report the XG Mobile GPU vendor to asus-wmi
Date: Mon, 26 Oct 2026 00:03:25 +0000 [thread overview]
Message-ID: <sashiko-outbox-184543@kernel.org> (raw)
In-Reply-To: <20261025235232.129945-18-denis.benato@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] HID: asus: u8 gpu_id[4] truncates 16-bit PCI vendor ID in asus_xgm_init()
--
commit 739505f96f6292806a14e712690bf33782dd803a
Author: Denis Benato <denis.benato@linux.dev>
HID: asus: report the XG Mobile GPU vendor to asus-wmi
This commit parses the 4-part GPU PCI ID from the XG Mobile station version
query response and reports the GPU vendor ID to asus-wmi on initialization,
clearing it when the station is unbound.
> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
> index e444cad85b32c..244d103fbd4c8 100644
> --- a/drivers/hid/hid-asus.c
> +++ b/drivers/hid/hid-asus.c
> @@ -186,6 +186,7 @@ struct asus_xgm_info {
> char part_number[ASUS_XGM_INFO_LEN];
> char firmware_version[ASUS_XGM_INFO_LEN];
> char generation[ASUS_XGM_INFO_LEN];
> + u8 gpu_id[4];
> };
>
> struct asus_touchpad_info {
> @@ -6313,6 +6314,12 @@ static int asus_xgm_get_version(struct hid_device *hdev,
> asus_xgm_tlv_str(info->firmware_version, sizeof(info->firmware_version),
> buf, len, "VER");
>
> + /* the 4-part PCI ID of the GPU installed in the station: buf[3..10] */
> + if (len < 11)
> + return -ENODATA;
> +
> + memcpy(info->gpu_id, buf + 3, sizeof(info->gpu_id));
> +
> return 0;
> }
>
> @@ -6685,6 +6692,8 @@ static int asus_xgm_init(struct hid_device *hdev, struct asus_drvdata *drvdata)
> hid_info(hdev, "XG Mobile: firmware %s, generation %s\n",
> info->firmware_version, info->generation);
>
> + asus_wmi_egpu_set_vendor(info->gpu_id[0]);
[Severity: High]
Does declaring gpu_id as u8 gpu_id[4] in struct asus_xgm_info truncate the
16-bit PCI vendor ID to a single byte?
In asus_xgm_get_version(), the comment and length check expect the 4-part
PCI ID to occupy 8 bytes in buf[3..10] (four 16-bit fields), but
sizeof(info->gpu_id) is 4, so memcpy() only copies buf[3..6].
When asus_probe() -> asus_xgm_init() calls
asus_wmi_egpu_set_vendor(info->gpu_id[0]), it passes a single u8 value
(0x00..0xff) to asus_wmi_egpu_set_vendor(u16 vendor). Downstream in
drivers/platform/x86/asus-armoury.c:egpu_default_enable_value():
static u32 egpu_default_enable_value(void)
{
switch (asus_wmi_egpu_vendor()) {
case PCI_VENDOR_ID_ATI:
return 0x0101;
case PCI_VENDOR_ID_INTEL:
return 0x0201;
default:
return 0x0001;
}
}
the 8-bit value can never match the 16-bit constants PCI_VENDOR_ID_ATI
(0x1002) or PCI_VENDOR_ID_INTEL (0x8086), causing egpu_enable to always fall
back to 0x0001.
Should gpu_id be a 4-element 16-bit array (such as u16 gpu_id[4] or __le16
gpu_id[4] with the appropriate endianness conversion) so the full 8-byte
PCI ID is stored and the 16-bit vendor ID is passed to
asus_wmi_egpu_set_vendor()?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261025235232.129945-1-denis.benato@linux.dev?part=17
next prev parent reply other threads:[~2026-10-26 0:03 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-25 23:52 [PATCH v11 00/18] HID: asus: add support for ROG Ally handhelds Denis Benato
2026-10-25 23:52 ` [PATCH v11 01/18] " Denis Benato
2026-10-26 0:10 ` sashiko-bot
2026-10-26 12:38 ` Ilpo Järvinen
2026-10-25 23:52 ` [PATCH v11 02/18] HID: asus: add gamepad configuration Denis Benato
2026-10-26 0:10 ` sashiko-bot
2026-10-26 12:56 ` Ilpo Järvinen
2026-10-25 23:52 ` [PATCH v11 03/18] HID: asus: add vibration strength configuration Denis Benato
2026-10-25 23:52 ` [PATCH v11 04/18] HID: asus: add joysticks inner and outer range configuration Denis Benato
2026-10-26 13:00 ` Ilpo Järvinen
2026-10-25 23:52 ` [PATCH v11 05/18] HID: asus: add triggers " Denis Benato
2026-10-25 23:52 ` [PATCH v11 06/18] HID: asus: add joysticks anti-deadzone configuration Denis Benato
2026-10-25 23:52 ` [PATCH v11 07/18] HID: asus: add support for response curve Denis Benato
2026-10-26 13:06 ` Ilpo Järvinen
2026-10-25 23:52 ` [PATCH v11 08/18] HID: asus: add support to force feedback Denis Benato
2026-10-26 0:19 ` sashiko-bot
2026-10-26 12:36 ` Sakari Ailus
2026-10-26 18:21 ` Ilpo Järvinen
2026-10-26 18:27 ` Sakari Ailus
2026-10-26 13:13 ` Ilpo Järvinen
2026-10-25 23:52 ` [PATCH v11 09/18] HID: asus: add support for gamepad mode Denis Benato
2026-10-26 13:20 ` Ilpo Järvinen
2026-10-25 23:52 ` [PATCH v11 10/18] HID: asus: add support for turbo buttons Denis Benato
2026-10-26 13:29 ` Ilpo Järvinen
2026-10-25 23:52 ` [PATCH v11 11/18] HID: asus: add support for btn remapping Denis Benato
2026-10-26 0:06 ` sashiko-bot
2026-10-26 14:03 ` Ilpo Järvinen
2026-10-25 23:52 ` [PATCH v11 12/18] HID: asus: size feature reports from the HID report descriptor Denis Benato
2026-10-26 0:06 ` sashiko-bot
2026-10-26 13:06 ` Rebecca Mara Müller
2026-10-26 19:38 ` Denis Benato
2026-10-25 23:52 ` [PATCH v11 13/18] HID: asus: identify XG Mobile stations and bind the LED to the reported model Denis Benato
2026-10-25 23:52 ` [PATCH v11 14/18] HID: asus: expose XG Mobile identity and firmware information Denis Benato
2026-10-26 0:05 ` sashiko-bot
2026-10-26 14:10 ` Ilpo Järvinen
2026-10-25 23:52 ` [PATCH v11 15/18] HID: asus: size ally gamepad commands from the HID report descriptor Denis Benato
2026-10-26 0:10 ` sashiko-bot
2026-10-25 23:52 ` [PATCH v11 16/18] platform/x86: asus-armoury: pick the eGPU activation from the reported GPU Denis Benato
2026-10-25 23:52 ` [PATCH v11 17/18] HID: asus: report the XG Mobile GPU vendor to asus-wmi Denis Benato
2026-10-26 0:03 ` sashiko-bot [this message]
2026-10-26 14:15 ` Ilpo Järvinen
2026-10-25 23:52 ` [PATCH v11 18/18] MAINTAINERS: add maintainer for the ASUS HID driver Denis Benato
2026-10-26 14:24 ` [PATCH v11 00/18] HID: asus: add support for ROG Ally handhelds Ilpo Järvinen
2026-10-26 18:03 ` Denis Benato
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=sashiko-outbox-184543@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=denis.benato@linux.dev \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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