Re: [PATCH v7 3/3] HID: nintendo: Add unified report format support
From: sashiko-bot@kernel.org
Date: 2026-06-30 08:59:29
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] The global HID report size check was incorrectly tightened to 17 bytes, silently dropping valid input reports for non-unified controllers. -- commit 2414bf53574e3d2b6aee6b978aeb58f941052e21 Author: Vicki Pfau [off-list ref] HID: nintendo: Add unified report format support This commit adds support for the unified report format for various Nintendo controllers. It maps their respective buttons and axes to the new unified formats.
quoted hunk ↗ jump to hunk
diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c index a53c554a54ae3..4920c9691b08a 100644 --- a/drivers/hid/hid-nintendo.c +++ b/drivers/hid/hid-nintendo.c
[ ... ]
quoted hunk ↗ jump to hunk
@@ -3765,7 +3866,7 @@ static int switch2_event(struct hid_device *hdev, struct hid_report *report, uin if (report->type != HID_INPUT_REPORT) return 0; - if (size < 15) + if (size < 17) return -EINVAL;
[Severity: High] Does tightening this global size check to 17 bytes silently drop valid input reports for non-unified controllers? Looking at the other cases in switch2_event(), such as NS2_REPORT_GC, the driver previously validated against a 15-byte minimum because it only accesses up to raw_data[14]. By unconditionally checking if the size is less than 17 before evaluating the report ID, any 15-byte or 16-byte report will hit this early return and be rejected with -EINVAL. Should this size requirement be localized strictly to the NS2_REPORT_UNIFIED branch to avoid breaking functionality for legacy controllers?
quoted hunk ↗ jump to hunk
guard(rcu)();@@ -3776,11 +3877,51 @@ static int switch2_event(struct hid_device *hdev, struct hid_report *report, uin switch (report->id) { case NS2_REPORT_UNIFIED:
[ ... ] -- Sashiko AI review · https://sashiko.dev/#/patchset/20260630084838.2313379-1-vi@endrift.com?part=3