[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 01/16] Allow zero alloc_hint in qemu_sglist_init()
From: |
Hannes Reinecke |
Subject: |
[Qemu-devel] [PATCH 01/16] Allow zero alloc_hint in qemu_sglist_init() |
Date: |
Thu, 18 Nov 2010 15:44:34 +0100 |
User-agent: |
Heirloom mailx 12.2 01/07/07 |
qemu_malloc doesn't check for zero argument, so we need to
check ourselves.
Signed-off-by: Hannes Reinecke <address@hidden>
---
dma-helpers.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/dma-helpers.c b/dma-helpers.c
index 712ed89..877b2c3 100644
--- a/dma-helpers.c
+++ b/dma-helpers.c
@@ -12,7 +12,10 @@
void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint)
{
- qsg->sg = qemu_malloc(alloc_hint * sizeof(ScatterGatherEntry));
+ if (alloc_hint > 0)
+ qsg->sg = qemu_malloc(alloc_hint * sizeof(ScatterGatherEntry));
+ else
+ qsg->sg = NULL;
qsg->nsg = 0;
qsg->nalloc = alloc_hint;
qsg->size = 0;
--
1.7.1
- [Qemu-devel] [PATCH 01/16] Allow zero alloc_hint in qemu_sglist_init(),
Hannes Reinecke <=