qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3 2/3] block: Fix NULL deference for unaligned


From: Fam Zheng
Subject: Re: [Qemu-devel] [PATCH v3 2/3] block: Fix NULL deference for unaligned write if qiov is NULL
Date: Mon, 27 Apr 2015 20:41:57 +0800
User-agent: Mutt/1.5.23 (2014-03-12)

On Mon, 04/27 12:45, Paolo Bonzini wrote:
> 
> 
> On 27/04/2015 07:40, Fam Zheng wrote:
> > +
> > +    if (!qiov) {
> 
> Perhaps "if (!qiov && bytes >= align)"?

Yes, that's right, we don't want 0 aligned_bytes here.

Fam

> 
> 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;
> >      }
> 



reply via email to

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