Skip to content

Commit c183950

Browse files
committed
ALSA: firewire-lib: fix wrong value as length of header for CIP_NO_HEADER case
In a commit 1d71712 ("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: 1d71712 ("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>
1 parent 00e3913 commit c183950

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

sound/firewire/amdtp-stream.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,8 +1180,7 @@ static void process_rx_packets(struct fw_iso_context *context, u32 tstamp, size_
11801180
(void)fw_card_read_cycle_time(fw_parent_device(s->unit)->card, &curr_cycle_time);
11811181

11821182
for (i = 0; i < packets; ++i) {
1183-
DEFINE_FLEX(struct fw_iso_packet, template, header,
1184-
header_length, CIP_HEADER_QUADLETS);
1183+
DEFINE_RAW_FLEX(struct fw_iso_packet, template, header, CIP_HEADER_QUADLETS);
11851184
bool sched_irq = false;
11861185

11871186
build_it_pkt_header(s, desc->cycle, template, pkt_header_length,

0 commit comments

Comments
 (0)