Commit fc47eea4 authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Luis Henriques

ALSA: fireworks: fix an endianness bug for transaction length

commit 92cb4658 upstream.

Although the 't->length' is a big-endian value, it's used without any
conversion. This means that the driver always uses 'length' parameter.

Fixes: 555e8a8f("ALSA: fireworks: Add command/response functionality into hwdep interface")
Reported-by: default avatarClemens Ladisch <clemens@ladisch.de>
Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent cfa91192
...@@ -124,7 +124,7 @@ copy_resp_to_buf(struct snd_efw *efw, void *data, size_t length, int *rcode) ...@@ -124,7 +124,7 @@ copy_resp_to_buf(struct snd_efw *efw, void *data, size_t length, int *rcode)
spin_lock_irq(&efw->lock); spin_lock_irq(&efw->lock);
t = (struct snd_efw_transaction *)data; t = (struct snd_efw_transaction *)data;
length = min_t(size_t, t->length * sizeof(t->length), length); length = min_t(size_t, be32_to_cpu(t->length) * sizeof(u32), length);
if (efw->push_ptr < efw->pull_ptr) if (efw->push_ptr < efw->pull_ptr)
capacity = (unsigned int)(efw->pull_ptr - efw->push_ptr); capacity = (unsigned int)(efw->pull_ptr - efw->push_ptr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment