Skip to content

Commit cb1bcf5

Browse files
takaswietiwai
authored andcommitted
ALSA: firewire-motu: fix truncated bytes in message tracepoints
In MOTU protocol v2/v3, first two data chunks across 2nd and 3rd data channels includes message bytes from device. The total size of message is 48 bits per data block. The 'data_block_message' tracepoints event produced by ALSA firewire-motu driver exposes the sequence of messages to userspace in 64 bit storage, however lower 32 bits are actually available since current implementation truncates 16 bits in upper of the message as a result of bit shift operation within 32 bit storage. This commit fixes the bug by perform the bit shift in 64 bit storage. Fixes: c6b0b9e ("ALSA: firewire-motu: add tracepoints for messages for unique protocol") Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210920110734.27161-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 77ff9e7 commit cb1bcf5

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎sound/firewire/motu/amdtp-motu.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,11 @@ static void __maybe_unused copy_message(u64 *frames, __be32 *buffer,
276276

277277
/* This is just for v2/v3 protocol. */
278278
for (i = 0; i < data_blocks; ++i) {
279-
*frames = (be32_to_cpu(buffer[1]) << 16) |
280-
(be32_to_cpu(buffer[2]) >> 16);
279+
*frames = be32_to_cpu(buffer[1]);
280+
*frames <<= 16;
281+
*frames |= be32_to_cpu(buffer[2]) >> 16;
282+
++frames;
281283
buffer += data_block_quadlets;
282-
frames++;
283284
}
284285
}
285286

0 commit comments

Comments
 (0)