From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmgXO-00072r-Io for qemu-devel@nongnu.org; Mon, 27 Apr 2015 06:45:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YmgXK-0006xP-JS for qemu-devel@nongnu.org; Mon, 27 Apr 2015 06:45:18 -0400 Sender: Paolo Bonzini Message-ID: <553E132E.6010606@redhat.com> Date: Mon, 27 Apr 2015 12:45:02 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1430113219-12522-1-git-send-email-famz@redhat.com> <1430113219-12522-3-git-send-email-famz@redhat.com> In-Reply-To: <1430113219-12522-3-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 2/3] block: Fix NULL deference for unaligned write if qiov is NULL List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Stefan Hajnoczi , qemu-stable@nongnu.org, qemu-block@nongnu.org On 27/04/2015 07:40, Fam Zheng wrote: > + > + if (!qiov) { Perhaps "if (!qiov && bytes >= align)"? Paolo > + uint64_t aligned_bytes = bytes & ~(align - 1); > + > + assert((offset & (align - 1)) == 0); > + ret = bdrv_aligned_pwritev(bs, &req, offset, aligned_bytes, > + NULL, flags); > + if (ret < 0) { > + goto fail; > + } > + bytes -= aligned_bytes; > + offset += aligned_bytes; > }