From: Takashi Iwai Subject: Re: [PATCH] ALSA: fireworks: fix an endianness bug for transaction length Date: Wed, 07 Jan 2015 16:40:24 +0100 Message-ID: References: <5484C572.7040606@ladisch.de> <1420644676-29863-1-git-send-email-o-takashi@sakamocchi.jp> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 06C5F26054F for ; Wed, 7 Jan 2015 16:40:25 +0100 (CET) In-Reply-To: <1420644676-29863-1-git-send-email-o-takashi@sakamocchi.jp> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Takashi Sakamoto Cc: alsa-devel@alsa-project.org, clemens@ladisch.de List-Id: alsa-devel@alsa-project.org At Thu, 8 Jan 2015 00:31:16 +0900, Takashi Sakamoto wrote: > > 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: 555e8a8f7f14("ALSA: fireworks: Add command/response functionality into hwdep interface") > Reported-by: Clemens Ladisch > Signed-off-by: Takashi Sakamoto Applied, thanks. Takashi > --- > sound/firewire/fireworks/fireworks_transaction.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sound/firewire/fireworks/fireworks_transaction.c b/sound/firewire/fireworks/fireworks_transaction.c > index 255dabc..2a85e42 100644 > --- a/sound/firewire/fireworks/fireworks_transaction.c > +++ b/sound/firewire/fireworks/fireworks_transaction.c > @@ -124,7 +124,7 @@ copy_resp_to_buf(struct snd_efw *efw, void *data, size_t length, int *rcode) > spin_lock_irq(&efw->lock); > > 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) > capacity = (unsigned int)(efw->pull_ptr - efw->push_ptr); > -- > 2.1.0 >