[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-stable] [PATCH v3 2/3] block: Fix NULL deference for unaligned
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-stable] [PATCH v3 2/3] block: Fix NULL deference for unaligned write if qiov is NULL |
Date: |
Mon, 27 Apr 2015 12:45:02 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
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;
> }