[PATCH] make i810_audio GETOSPACE consistent with i810_write()

Tobias Diedrich (ranma@gmx.at)
Wed, 7 Nov 2001 19:40:01 +0100


Hi,

This fixes a bug in i810_ioctl(), which made the GETOSPACE ioctl return
a different value than that checked against in i810_write.

>From i810_write():
| cnt = dmabuf->dmasize - dmabuf->fragsize - dmabuf->count;
| // this is to make the copy_from_user simpler below
| if(cnt > (dmabuf->dmasize - swptr))
| cnt = dmabuf->dmasize - swptr;
| spin_unlock_irqrestore(&state->card->lock, flags);
|
|#ifdef DEBUG2
| printk(KERN_INFO "i810_audio: i810_write: %d bytes available spa
|ce\n", cnt);
|#endif

where cnt is the space available.

Please apply

--- linux-2.4.10-ac12/drivers/sound/i810_audio.c Wed Nov 7 19:15:31 2001
+++ linux-2.4.10-ifia/drivers/sound/i810_audio.c Wed Nov 7 19:02:10 2001
@@ -1860,7 +1860,7 @@
if(dmabuf->mapped)
abinfo.bytes = dmabuf->count;
else
- abinfo.bytes = dmabuf->dmasize - dmabuf->count;
+ abinfo.bytes = dmabuf->dmasize - dmabuf->fragsize - dmabuf->count;
abinfo.fragments = abinfo.bytes / dmabuf->userfragsize;
spin_unlock_irqrestore(&state->card->lock, flags);
#ifdef DEBUG

-- 
Tobias								PGP: 0x9AC7E0BC
Hannover Fantreffen ML: mailto:fantreffen-request@mantrha.de?subject=subscribe
Manga & Anime Treff Hannover: http://www.mantrha.de/
-
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/