From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758576AbYDPQbr (ORCPT ); Wed, 16 Apr 2008 12:31:47 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759095AbYDPQbk (ORCPT ); Wed, 16 Apr 2008 12:31:40 -0400 Received: from mx1.suse.de ([195.135.220.2]:43851 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756602AbYDPQbj (ORCPT ); Wed, 16 Apr 2008 12:31:39 -0400 Date: Wed, 16 Apr 2008 18:31:38 +0200 Message-ID: From: Takashi Iwai To: Roel Kluin <12o3l@tiscali.nl> Cc: perex@perex.cz, alsa-devel@alsa-project.org, lkml Subject: Re: [alsa-devel] [PATCH 6/6] sound/drivers/dummy.c: fix negative snd_pcm_format_width() check In-Reply-To: <48062751.8040309@tiscali.nl> References: <480558CA.7090800@tiscali.nl> <48062751.8040309@tiscali.nl> User-Agent: Wanderlust/2.15.5 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 MULE XEmacs/21.5 (beta28) (fuki) (+CVS-20070806) (i386-suse-linux) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Wed, 16 Apr 2008 18:20:33 +0200, Roel Kluin wrote: > > bps is unsigned, a negative snd_pcm_format_width() return value is not noticed > > Signed-off-by: Roel Kluin <12o3l@tiscali.nl> Applied to ALSA tree. Thanks. Takashi > --- > diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c > index a240eae..1c88977 100644 > --- a/sound/drivers/dummy.c > +++ b/sound/drivers/dummy.c > @@ -230,13 +230,14 @@ static int snd_card_dummy_pcm_prepare(struct snd_pcm_substream *substream) > { > struct snd_pcm_runtime *runtime = substream->runtime; > struct snd_dummy_pcm *dpcm = runtime->private_data; > - unsigned int bps; > + int bps; > + > + bps = snd_pcm_format_width(runtime->format) * runtime->rate * > + runtime->channels / 8; > > - bps = runtime->rate * runtime->channels; > - bps *= snd_pcm_format_width(runtime->format); > - bps /= 8; > if (bps <= 0) > return -EINVAL; > + > dpcm->pcm_bps = bps; > dpcm->pcm_jiffie = bps / HZ; > dpcm->pcm_size = snd_pcm_lib_buffer_bytes(substream); > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel >