]> www.infradead.org Git - users/hch/block.git/commit
ALSA: firewire-lib: fix wrong value as length of header for CIP_NO_HEADER case
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Thu, 25 Jul 2024 15:56:40 +0000 (00:56 +0900)
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sat, 27 Jul 2024 01:28:36 +0000 (10:28 +0900)
commitc1839501fe3e67d98635f159dba8b170d08f6521
treed8f352f337d752abdf8944008ece4dd11ce146aa
parent00e3913b0416fe69d28745c0a2a340e2f76c219c
ALSA: firewire-lib: fix wrong value as length of header for CIP_NO_HEADER case

In a commit 1d717123bb1a ("ALSA: firewire-lib: Avoid
-Wflex-array-member-not-at-end warning"), DEFINE_FLEX() macro was used to
handle variable length of array for header field in struct fw_iso_packet
structure. The usage of macro has a side effect that the designated
initializer assigns the count of array to the given field. Therefore
CIP_HEADER_QUADLETS (=2) is assigned to struct fw_iso_packet.header,
while the original designated initializer assigns zero to all fields.

With CIP_NO_HEADER flag, the change causes invalid length of header in
isochronous packet for 1394 OHCI IT context. This bug affects all of
devices supported by ALSA fireface driver; RME Fireface 400, 800, UCX, UFX,
and 802.

This commit fixes the bug by replacing it with the alternative version of
macro which corresponds no initializer.

Cc: stable@vger.kernel.org
Fixes: 1d717123bb1a ("ALSA: firewire-lib: Avoid -Wflex-array-member-not-at-end warning")
Reported-by: Edmund Raile <edmund.raile@proton.me>
Closes: https://lore.kernel.org/r/rrufondjeynlkx2lniot26ablsltnynfaq2gnqvbiso7ds32il@qk4r6xps7jh2/
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240725155640.128442-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
sound/firewire/amdtp-stream.c