qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/5] qemu-char: Add new char backend CircularMem


From: Luiz Capitulino
Subject: Re: [Qemu-devel] [PATCH 1/5] qemu-char: Add new char backend CircularMemCharDriver
Date: Tue, 23 Oct 2012 10:42:23 -0200

On Tue, 23 Oct 2012 13:40:13 +0800
Lei Li <address@hidden> wrote:

> >> +static int cirmem_chr_write(CharDriverState *chr, const uint8_t *buf, int 
> >> len)
> >> +{
> >> +    CirMemCharDriver *d = chr->opaque;
> >> +    int i;
> >> +
> >> +    if (len < 0) {
> >> +        return -1;
> >> +    }
> >> +
> >> +    /* The size should be a power of 2. */
> > Shouldn't you enforce that, then?
> 
> Yes, it has been checked when open the CirMemChar backend in patch 2/5,
> as code below:
> 
> if (d->size & (d->size -1)) {
>      return NULL;
> }

You could add an assert() in cirmem_chr_write() then.



reply via email to

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