Skip to content

Commit

Permalink
OSS: dmabuf: fix negative DMAbuf_get_buffer_pointer() check
Browse files Browse the repository at this point in the history
Since unsigned active_offs < 0 is even true when DMAbuf_get_buffer_pointer()
returns negative

Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Roel Kluin authored and Takashi Iwai committed Apr 24, 2008
1 parent e34ba21 commit 0d52cea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sound/oss/dmabuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0d52cea

Please sign in to comment.