From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xip41-0004i7-L8 for qemu-devel@nongnu.org; Mon, 27 Oct 2014 14:30:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xip3v-0006pO-GF for qemu-devel@nongnu.org; Mon, 27 Oct 2014 14:30:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43228) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xip3v-0006pG-8G for qemu-devel@nongnu.org; Mon, 27 Oct 2014 14:30:39 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9RIUcSJ010728 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 27 Oct 2014 14:30:38 -0400 Message-ID: <544E8F4C.1000303@redhat.com> Date: Mon, 27 Oct 2014 14:30:36 -0400 From: John Snow MIME-Version: 1.0 References: <1412204151-18117-1-git-send-email-jsnow@redhat.com> <1412204151-18117-6-git-send-email-jsnow@redhat.com> <544E1931.8030209@redhat.com> In-Reply-To: <544E1931.8030209@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 5/6] ide: Correct handling of malformed/short PRDTs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: kwolf@redhat.com, armbru@redhat.com, stefanha@redhat.com, mst@redhat.com 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