Linux LED subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Liang Haowen" <nbg2974@gmail.com>
Cc: linux-scsi@vger.kernel.org, lee@kernel.org, linux-leds@vger.kernel.org
Subject: Re: [RFC v8 1/1] leds: asus-aura-scsi: Add ASUS Aura RGB LED driver for ROG NVMe enclosures
Date: Wed, 23 Sep 2026 12:33:22 +0000	[thread overview]
Message-ID: <20260923123322.98C631F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260923121832.2613187-2-nbg2974@gmail.com>

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [High] leds: memory corruption due to unaligned DMA buffer tx sharing cacheline
- [Low] leds: build failure due to undefined macro kzalloc_obj
- [Low] leds: build failure due to missing argument in blk_rq_map_kern()
- [Low] leds: build failure due to missing size argument in strscpy()
--

commit 823a081d978e63fdae64dbf79945582f7cc88fe2
Author: Liang Haowen <nbg2974@gmail.com>

leds: asus-aura-scsi: Add ASUS Aura RGB LED driver for ROG NVMe enclosures

This commit adds a new driver for ASUS Aura RGB LEDs present on ROG external
NVMe enclosures. It operates by registering a SCSI device handler to intercept
and issue vendor-specific SCSI commands to control the LEDs.

> diff --git a/drivers/leds/rgb/leds-asus-aura-scsi.c b/drivers/leds/rgb/leds-asus-aura-scsi.c
> index 0000000000000..eaba968598dbf 100644
> --- /dev/null
> +++ b/drivers/leds/rgb/leds-asus-aura-scsi.c
[ ... ]
> +struct asus_aura {
> +	struct scsi_device	*sdev;
> +	struct asus_aura_led	leds[ARION_NUM_LEDS];
> +
> +	/* Serializes the cached colours and pending flags. */
> +	spinlock_t		lock;
> +	struct work_struct	work;
> +
> +	/* DMA-safe staging buffer, the only memory ever mapped for DMA. */
> +	u8			tx[ENE_RGB_LEN];
> +};

[Severity: High]
Can this corrupt memory on non-cache-coherent architectures? The tx buffer is
a 3-byte array sharing a cacheline with the lock and work members. If mapped
for DMA, a cacheline invalidation during the DMA operation could clobber
concurrent CPU writes to the lock (e.g., from asus_aura_set()), leading to
lock corruption and crashes. Should this buffer be isolated to its own
cacheline using ____cacheline_aligned?

[ ... ]
> +static int ene_write_reg(struct asus_aura *aura, u16 reg,
> +			 const u8 *tx, u8 len)
> +{
[ ... ]
> +	/*
> +	 * Stack memory is not DMA-safe (VMAP_STACK), so the payload is
> +	 * copied into the per-device buffer first.
> +	 */
> +	memcpy(aura->tx, tx, len);
> +	ret = blk_rq_map_kern(rq, aura->tx, len, GFP_NOIO);

[Severity: Low]
Does this code compile? The blk_rq_map_kern() function requires five
arguments, including the request queue (struct request_queue *q) as the
first parameter, but only four are provided here.

[ ... ]
> +static int asus_aura_register_led(struct asus_aura *aura, int index)
> +{
[ ... ]
> +	/*
> +	 * The sdev's H:C:T:L keeps the names unique when more than one
> +	 * enclosure is connected; with a static name the LED core would
> +	 * register a second enclosure's LEDs under renamed nodes
> +	 * (asus-arion::led-0_1), the wrong device identity. The colons
> +	 * are flattened to dashes, the color section stays empty
> +	 * (multicolor, palette via multi_intensity) and the four
> +	 * identical zones take a "-N" ordinal, as
> +	 * Documentation/leds/leds-class.rst asks for.
> +	 */
> +	strscpy(hctl, dev_name(&aura->sdev->sdev_gendev));

[Severity: Low]
Does this build? The strscpy() function takes three arguments: destination,
source, and the size of the destination buffer. The size argument is missing
here.

[ ... ]
> +static int asus_aura_attach(struct scsi_device *sdev)
> +{
> +	struct asus_aura *aura;
> +	int ret;
> +
> +	if (strncmp(sdev->vendor, ARION_INQ_VENDOR, strlen(ARION_INQ_VENDOR)) ||
> +	    strncmp(sdev->model, ARION_INQ_MODEL, strlen(ARION_INQ_MODEL)))
> +		return SCSI_DH_DEV_UNSUPP;
> +
> +	aura = kzalloc_obj(*aura, GFP_KERNEL);

[Severity: Low]
Is kzalloc_obj() a defined macro in this context? It seems its use here
could prevent the driver from compiling. Should this use kzalloc() with
sizeof(*aura) instead?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260923121832.2613187-1-nbg2974@gmail.com?part=1

  reply	other threads:[~2026-09-23 12:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23 12:18 [RFC v8 0/1] leds: asus-aura-scsi: Add ASUS Aura RGB LED driver for ROG NVMe enclosures Liang Haowen
2026-09-23 12:18 ` [RFC v8 1/1] " Liang Haowen
2026-09-23 12:33   ` sashiko-bot [this message]
2026-09-23 12:45   ` Ilpo Järvinen

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=20260923123322.98C631F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nbg2974@gmail.com \
    --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