diff options
author | Roel Kluin <12o3l@tiscali.nl> | 2008-04-18 12:25:41 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-04-24 12:00:39 +0200 |
commit | 0d52cea487c0213d6d7bca9c951210081e7b653b (patch) | |
tree | 86084e64ed325a7b9dd6362874d92336a86eff27 /sound/oss/dmabuf.c | |
parent | e34ba212225a27cdf5f974be22cc539ae7ee7ca5 (diff) | |
download | op-kernel-dev-0d52cea487c0213d6d7bca9c951210081e7b653b.zip op-kernel-dev-0d52cea487c0213d6d7bca9c951210081e7b653b.tar.gz |
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: Roel Kluin <12o3l@tiscali.nl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/oss/dmabuf.c')
-rw-r--r-- | sound/oss/dmabuf.c | 4 |
1 files changed, 2 insertions, 2 deletions
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 |