Re: [PATCH] ALSA: hdsp: enlarge the MIDI name buffer

From: Takashi Iwai

Date: Mon Nov 16 2026 - 09:31:38 EST


On Sat, 14 Nov 2026 14:02:20 +0100,
Aibing Chen wrote:
>
> snd_hdsp_create_midi() formats "<card shortname> MIDI <n>" into a 40
> byte buffer. The card shortname can be up to 31 characters, " MIDI "
> adds 6 and the MIDI number up to 11, so the name can reach 48
> characters plus the terminator.
>
> Building with W=1 reports a -Wformat-truncation warning: the output can
> reach 49 bytes including the terminator into a destination of size 40.
> Only the rawmidi device name is affected, so nothing changes apart from
> the name no longer being cut short.
>
> Signed-off-by: Aibing Chen <chenaibing@xxxxxxxxxxxxxxxxxxxx>

The real question is whether it really overflows and truncated with
the driver's actual setups. Otherwise it's nothing wrong in the code,
per se.

Could you verify that?


thanks,

Takashi