From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wsu2B-0002RZ-Nh for qemu-devel@nongnu.org; Fri, 06 Jun 2014 09:18:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wsu25-0007Pd-Kk for qemu-devel@nongnu.org; Fri, 06 Jun 2014 09:18:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4522) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wsu25-0007Nv-CK for qemu-devel@nongnu.org; Fri, 06 Jun 2014 09:18:09 -0400 Message-ID: <5391BF8A.8000709@redhat.com> Date: Fri, 06 Jun 2014 15:18:02 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1402019610-2985-1-git-send-email-famz@redhat.com> <1402019610-2985-10-git-send-email-famz@redhat.com> <20140606131649.GE14322@stefanha-thinkpad> In-Reply-To: <20140606131649.GE14322@stefanha-thinkpad> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 9/9] virtio-blk: Fix and clean up the in_sg and out_sg check List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , Fam Zheng Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi Il 06/06/2014 15:16, Stefan Hajnoczi ha scritto: >> > - req->in = (void *)req->elem->in_sg[req->elem->in_num - 1].iov_base; >> > + assert(in_iov[in_num - 1].iov_len >= >> > + sizeof(struct virtio_blk_inhdr)); > Why use assert() when the rest of the function uses error_report() + > exit(1)? Please keep the code consistent. Sorry, that's my fault. I suggested assert thinking that zero-length iovecs wouldn't be possible here. Paolo