LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] OSS: dmabuf: fix negative DMAbuf_get_buffer_pointer() check
@ 2008-04-17 18:38 Roel Kluin
  2008-04-18 10:28 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2008-04-17 18:38 UTC (permalink / raw)
  To: lkml

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>
---
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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] OSS: dmabuf: fix negative DMAbuf_get_buffer_pointer() check
  2008-04-17 18:38 [PATCH] OSS: dmabuf: fix negative DMAbuf_get_buffer_pointer() check Roel Kluin
@ 2008-04-18 10:28 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2008-04-18 10:28 UTC (permalink / raw)
  To: Roel Kluin; +Cc: lkml

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/
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-04-18 10:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-17 18:38 [PATCH] OSS: dmabuf: fix negative DMAbuf_get_buffer_pointer() check Roel Kluin
2008-04-18 10:28 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).