Re: [PATCH v2 02/10] soundwire: sysfs: Use sysfs_emit_at() in array show callbacks

From: Charles Keepax

Date: Fri Nov 13 2026 - 13:56:42 EST


On Tue, Nov 03, 2026 at 09:53:46AM +0000, Lee Jones wrote:
> words_show() and the show callbacks generated by sdw_dpn_array_attr()
> format firmware-supplied property arrays into the sysfs buffer using
> unbounded sprintf(buf + size, ...) loops. If firmware provides a large
> array count, sprintf() can write past PAGE_SIZE and corrupt kernel
> memory.
>
> Replace the sprintf(buf + size, ...) calls with bounds-checked
> sysfs_emit_at() calls.
>
> Closes: https://sashiko.dev/#/bug/linux-543ff498-3bed-412d-8972-4855c5aa6008
> Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
> ---

Reviewed-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>
Tested-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>

Thanks,
Charles