qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 5/6] ide: Correct handling of malformed/short PR


From: John Snow
Subject: Re: [Qemu-devel] [PATCH 5/6] ide: Correct handling of malformed/short PRDTs
Date: Mon, 27 Oct 2014 14:30:36 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0



On 10/27/2014 06:06 AM, Paolo Bonzini wrote:


On 10/02/2014 12:55 AM, John Snow wrote:
+    /* If this is true, you're leaking memory. */

... or qsg is uninitialized, which would work because qemu_sglist_init
initializes all fields.

This is the only comment I have on the series. :)

Paolo

+    assert(qsg->sg == NULL);
+
      qsg->sg = g_malloc(alloc_hint * sizeof(ScatterGatherEntry));


@@ -1147,7 +1147,7 @@ static int ahci_dma_prepare_buf(IDEDMA *dma, int is_write)
      s->io_buffer_size = s->sg.size;

      DPRINTF(ad->port_no, "len=%#x\n", s->io_buffer_size);
-    return s->io_buffer_size != 0;
+    return s->io_buffer_size / 512 != 0;
  }

oh, yeah :\

I really did want to guard against re-initialization, but if it's expected that this structure may have completely anything in it at init time, I don't really have a way to do that, do I.

I guess I'll just delete the assertion, unless you have a very simple idea to help guard against double-inits.

--j



reply via email to

[Prev in Thread] Current Thread [Next in Thread]