Linux Input/HID development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Andre Eikmeyer" <dev@deq.rocks>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH 2/2] HID: apple: use the standard keyboard backlight LED name
Date: Sat, 18 Jul 2026 12:36:41 +0000	[thread overview]
Message-ID: <20260718123641.DA2FF1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260718121527.15924-2-dev@deq.rocks>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing endianness conversion for USB HID report u16 fields.
--

--- Patch [2]: [PATCH 2/2] HID: apple: use the standard keyboard backlight LED name ---
commit fe5b7459cd5f35bce672b51255250e2d12f88cf4
Author: Andre Eikmeyer <dev@deq.rocks>

HID: apple: use the standard keyboard backlight LED name

This commit changes the exposed LED name for the T2-attached butterfly
keyboard backlight from apple::kbd_backlight to the standard
:white:kbd_backlight naming convention. This allows userspace to discover
and handle both the butterfly models and the Magic Keyboards using the same
name without special casing.

> diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
> --- a/drivers/hid/hid-apple.c
> +++ b/drivers/hid/hid-apple.c
> @@ -860,8 +860,8 @@ static int apple_backlight_init(struct hid_device *hdev)
>  	}
>  
>  	asc->backlight->hdev = hdev;
> -	asc->backlight->cdev.name = "apple::kbd_backlight";
> +	asc->backlight->cdev.name = ":white:" LED_FUNCTION_KBD_BACKLIGHT;
>  	asc->backlight->cdev.max_brightness = rep->backlight_on_max;

[Severity: High]
This is a pre-existing issue and was not introduced by this patch, but does
this code lack endianness conversion for the USB HID report fields?

According to the USB HID standard, multi-byte fields are little-endian.
Since rep->backlight_on_max is a u16 read directly from the raw device
report in apple_backlight_init(), could this result in byte-swapped values
on big-endian architectures and cause an out-of-bounds max_brightness?

A similar issue seems to be present in apple_backlight_set() where native
u16 values for rep->backlight and rep->rate are written into the report
struct without CPU to little-endian conversion before transmission.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260718121527.15924-1-dev@deq.rocks?part=2

  reply	other threads:[~2026-07-18 12:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-18 12:15 [PATCH 1/2] HID: apple: preserve keyboard backlight across T2 resume Andre Eikmeyer
2026-07-18 12:15 ` [PATCH 2/2] HID: apple: use the standard keyboard backlight LED name Andre Eikmeyer
2026-07-18 12:36   ` sashiko-bot [this message]
2026-07-18 15:00     ` Andre Eikmeyer
2026-07-18 12:35 ` [PATCH 1/2] HID: apple: preserve keyboard backlight across T2 resume sashiko-bot
2026-07-18 15:00   ` Andre Eikmeyer

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=20260718123641.DA2FF1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dev@deq.rocks \
    --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