From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757238AbYDRK2S (ORCPT ); Fri, 18 Apr 2008 06:28:18 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754824AbYDRK2J (ORCPT ); Fri, 18 Apr 2008 06:28:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:50213 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754642AbYDRK2H (ORCPT ); Fri, 18 Apr 2008 06:28:07 -0400 Date: Fri, 18 Apr 2008 12:28:06 +0200 Message-ID: From: Takashi Iwai To: Roel Kluin <12o3l@tiscali.nl> Cc: lkml Subject: Re: [PATCH] OSS: dmabuf: fix negative DMAbuf_get_buffer_pointer() check In-Reply-To: <48079941.3070209@tiscali.nl> References: <48079941.3070209@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 Thu, 17 Apr 2008 20:38:57 +0200, Roel Kluin wrote: > > Too late for OSS? > --- > Since unsigned active_offs < 0 is even true when DMAbuf_get_buffer_pointer() > returns negative > > Signed-off-by: Roel Kluin <12o3l@tiscali.nl> I applied it to my git tree. Thanks. Takashi > --- > diff --git a/sound/oss/dmabuf.c b/sound/oss/dmabuf.c > index eaf6997..1e90d76 100644 > --- a/sound/oss/dmabuf.c > +++ b/sound/oss/dmabuf.c > @@ -795,9 +795,9 @@ static int find_output_space(int dev, char **buf, int *size) > #ifdef BE_CONSERVATIVE > active_offs = dmap->byte_counter + dmap->qhead * dmap->fragment_size; > #else > - active_offs = DMAbuf_get_buffer_pointer(dev, dmap, DMODE_OUTPUT); > + active_offs = max(DMAbuf_get_buffer_pointer(dev, dmap, DMODE_OUTPUT), 0); > /* Check for pointer wrapping situation */ > - if (active_offs < 0 || active_offs >= dmap->bytes_in_use) > + if (active_offs >= dmap->bytes_in_use) > active_offs = 0; > active_offs += dmap->byte_counter; > #endif > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ >