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 v15 01/18] HID: asus: size feature reports from the HID report descriptor
Date: Tue, 10 Nov 2026 02:24:58 +0000 [thread overview]
Message-ID: <sashiko-outbox-206043@kernel.org> (raw)
In-Reply-To: <20261110020036.112884-2-denis.benato@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] HID: asus: report type mismatch in asus_has_report_id() and
asus_report_len()
--
commit 9e7f37337641ebe55d63a9fed78173afda17f344
Author: Denis Benato <denis.benato@linux.dev>
HID: asus: size feature reports from the HID report descriptor
This commit derives feature report transfer lengths from the device's HID
report descriptor via asus_report_len() instead of using hardcoded report
sizes.
> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
> index f6aa1be09ad53..46643022b68d0 100644
> --- a/drivers/hid/hid-asus.c
> +++ b/drivers/hid/hid-asus.c
[ ... ]
> +static size_t asus_report_len(struct hid_device *hdev, u8 report_id)
> +{
> + struct hid_report *report;
> +
> + report = asus_find_report(hdev, HID_FEATURE_REPORT, report_id);
> +
> + return report ? hid_report_len(report) : 0;
> +}
[ ... ]
> @@ -604,8 +687,13 @@ static int asus_kbd_init(struct hid_device *hdev, u8 report_id)
> */
> const u8 buf[] = { report_id, 0x41, 0x53, 0x55, 0x53, 0x20, 0x54,
> 0x65, 0x63, 0x68, 0x2e, 0x49, 0x6e, 0x63, 0x2e, 0x00 };
> + size_t hw_len = asus_report_len(hdev, report_id);
> + size_t cmp_len;
> int ret;
>
> + if (!hw_len)
> + return -EINVAL;
[ ... ]
> @@ -958,17 +1054,12 @@ static void validate_mcu_fw_version(struct hid_device *hdev, int idProduct)
>
> static bool asus_has_report_id(struct hid_device *hdev, u16 report_id)
> {
> - struct hid_report *report;
> - int t;
> + if (report_id >= HID_MAX_IDS)
> + return false;
>
> - for (t = HID_INPUT_REPORT; t <= HID_FEATURE_REPORT; t++) {
> - list_for_each_entry(report, &hdev->report_enum[t].report_list, list) {
> - if (report->id == report_id)
> - return true;
> - }
> - }
> -
> - return false;
> + return asus_find_report(hdev, HID_INPUT_REPORT, report_id) ||
> + asus_find_report(hdev, HID_OUTPUT_REPORT, report_id) ||
> + asus_find_report(hdev, HID_FEATURE_REPORT, report_id);
> }
[Severity: Medium]
Should asus_has_report_id() only check HID_FEATURE_REPORT?
Every caller of asus_has_report_id() gates feature-report operations that
now require asus_report_len() to find a HID_FEATURE_REPORT. On devices
such as the ROG G752 keyboard (QUIRK_G752_KEYBOARD) that declare report
0x5a only as an input report, asus_initialize_reports() sees
asus_has_report_id(hdev, 0x5a) return true, calls asus_kbd_init(), and
hits the !hw_len check, failing with -EINVAL and logging a warning on
probe and reset_resume.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110020036.112884-1-denis.benato@linux.dev?part=1
next prev parent reply other threads:[~2026-11-10 2:24 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 2:00 [PATCH v15 00/18] HID: asus: add support for ROG Ally handhelds Denis Benato
2026-11-10 2:00 ` [PATCH v15 01/18] HID: asus: size feature reports from the HID report descriptor Denis Benato
2026-11-10 2:24 ` sashiko-bot [this message]
2026-11-10 2:00 ` [PATCH v15 02/18] HID: asus: add support for ROG Ally handhelds Denis Benato
2026-11-10 2:26 ` sashiko-bot
2026-11-10 2:00 ` [PATCH v15 03/18] HID: asus: add gamepad configuration Denis Benato
2026-11-10 2:00 ` [PATCH v15 04/18] HID: asus: add vibration strength configuration Denis Benato
2026-11-10 2:00 ` [PATCH v15 05/18] HID: asus: add joysticks inner and outer range configuration Denis Benato
2026-11-10 2:00 ` [PATCH v15 06/18] HID: asus: add triggers " Denis Benato
2026-11-10 2:00 ` [PATCH v15 07/18] HID: asus: add joysticks anti-deadzone configuration Denis Benato
2026-11-10 2:00 ` [PATCH v15 08/18] HID: asus: add support for response curve Denis Benato
2026-11-10 2:00 ` [PATCH v15 09/18] HID: asus: add support to force feedback Denis Benato
2026-11-10 2:00 ` [PATCH v15 10/18] HID: asus: add support for gamepad mode Denis Benato
2026-11-10 2:00 ` [PATCH v15 11/18] HID: asus: add support for turbo buttons Denis Benato
2026-11-10 2:10 ` sashiko-bot
2026-11-10 2:00 ` [PATCH v15 12/18] HID: asus: add support for btn remapping Denis Benato
2026-11-10 2:17 ` sashiko-bot
2026-11-10 2:00 ` [PATCH v15 13/18] HID: asus: identify XG Mobile stations and bind the LED to the reported model Denis Benato
2026-11-10 2:00 ` [PATCH v15 14/18] HID: asus: expose XG Mobile identity and firmware information Denis Benato
2026-11-10 2:00 ` [PATCH v15 15/18] HID: asus: document ROG XG Mobile sysfs attributes Denis Benato
2026-11-10 2:00 ` [PATCH v15 16/18] HID: asus: document ROG Ally " Denis Benato
2026-11-10 2:00 ` [PATCH v15 17/18] platform/x86: asus-armoury: pick the eGPU activation from the reported GPU Denis Benato
2026-11-10 2:00 ` [PATCH v15 18/18] MAINTAINERS: add maintainer for the ASUS HID driver 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-206043@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