Patchwork Re: [sneak preview] major scsi overhaul

login
register
mail settings
Submitter Hannes Reinecke
Date Nov. 12, 2009, 9:54 a.m.
Message ID <4AFBDB53.7020400@suse.de>
Download mbox | patch
Permalink /patch/38228/
State New
Headers show

Comments

Hannes Reinecke - Nov. 12, 2009, 9:54 a.m.
Gerd Hoffmann wrote:
> On 11/11/09 14:30, Hannes Reinecke wrote:
>> Gerd Hoffmann wrote:
>>> How about sticking a 'void *hba_private' element into SCSIRequest
>>> instead?
>>>
>> Would work for me, too.
> 
> Pushed (scsi.v7 now).
> 
Okay, I've converted the driver.
Works so far.

One minor nitpick, though:


For some commands (eg TUR) alloc_hint would be '0' here,
causing qemu to barf.

Can you include this patch, too?

Cheers,

Hannes

Patch

diff --git a/dma-helpers.c b/dma-helpers.c
index 712ed89..0c57648 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;