[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] ivshmem: check ivshmem_read() size argument
From: |
Gerd Hoffmann |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] ivshmem: check ivshmem_read() size argument |
Date: |
Tue, 15 Apr 2014 07:39:55 +0200 |
> >> -static void ivshmem_read(void *opaque, const uint8_t * buf, int flags)
> >> +static void ivshmem_read(void *opaque, const uint8_t * buf, int size)
> >> {
> >> IVShmemState *s = opaque;
> >> int incoming_fd, tmp_fd;
> >> int guest_max_eventfd;
> >> long incoming_posn;
> >>
> >> + if (size < sizeof(incoming_posn)) {
> >> + IVSHMEM_DPRINTF("short read of %d bytes\n", size);
> >> + return;
> >> + }
> >> +
> >
> > Looking at the qemu-chr API I'm not sure this is correct:
> > aren't we going to throw away data here? My guess is that we
> > need to save the half-a-word so we can use it when the
> > other half arrives in a subsequent call.
correct.
cheers,
Gerd