Commit 0d52cea4 authored by Roel Kluin's avatar Roel Kluin Committed by Takashi Iwai

OSS: dmabuf: fix negative DMAbuf_get_buffer_pointer() check

Since unsigned active_offs < 0 is even true when DMAbuf_get_buffer_pointer()
returns negative
Signed-off-by: default avatarRoel Kluin <12o3l@tiscali.nl>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent e34ba212
...@@ -795,9 +795,9 @@ static int find_output_space(int dev, char **buf, int *size) ...@@ -795,9 +795,9 @@ static int find_output_space(int dev, char **buf, int *size)
#ifdef BE_CONSERVATIVE #ifdef BE_CONSERVATIVE
active_offs = dmap->byte_counter + dmap->qhead * dmap->fragment_size; active_offs = dmap->byte_counter + dmap->qhead * dmap->fragment_size;
#else #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 */ /* 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 = 0;
active_offs += dmap->byte_counter; active_offs += dmap->byte_counter;
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment