voron

experimental ARM OS
git clone git://git.2f30.org/voron
Log | Files | Refs | README | LICENSE

commit 263d36a92c39d879c9288b572353d4f7a3fff9ce
parent 6cd221502718901e6a43ed3a11ff2bca4ef52861
Author: sin <sin@2f30.org>
Date:   Sun, 21 Jul 2013 21:15:16 +0100

Enqueue/dequeue 0 bytes always succeeds

Diffstat:
Mkernel/kfifo.c | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/kernel/kfifo.c b/kernel/kfifo.c @@ -45,6 +45,9 @@ enqueue_kfifo(struct kfifo *kfifo, void *buf, size_t siz) { void *tmp; + if (!siz) + return 0; + spinlock_lock(&kfifo_lock); if (kfifo->cap - kfifo->siz >= siz) { memcpy(kfifo->buf + kfifo->siz, buf, siz); @@ -69,6 +72,9 @@ enqueue_kfifo(struct kfifo *kfifo, void *buf, size_t siz) int dequeue_kfifo(struct kfifo *kfifo, void *buf, size_t siz) { + if (!siz) + return 0; + spinlock_lock(&kfifo_lock); if (kfifo->siz < siz) { spinlock_unlock(&kfifo_lock);