[Qemu-devel] Re: [PATCH 33/41] virtio-net: port to vmstate

2009-12-03 Thread Juan Quintela
"Michael S. Tsirkin" wrote: ... >> but u32 don't fit in u8. And we read u32 into u8. I agree that writing >> u8 into u32 is not a problem, the problem is the reverse. > > So don't read u32 into u8. > Read data into u32, check that the value fits into u8, fail migration > if it does not, assign

[Qemu-devel] Re: [PATCH 33/41] virtio-net: port to vmstate

2009-12-03 Thread Michael S. Tsirkin
On Wed, Dec 02, 2009 at 08:18:40PM +0100, Juan Quintela wrote: > "Michael S. Tsirkin" wrote: > > On Wed, Dec 02, 2009 at 01:04:31PM +0100, Juan Quintela wrote: > >> > >> Signed-off-by: Juan Quintela > >> --- > >> hw/virtio-net.c | 148 > >> -

[Qemu-devel] Re: [PATCH 33/41] virtio-net: port to vmstate

2009-12-02 Thread Juan Quintela
"Michael S. Tsirkin" wrote: > On Wed, Dec 02, 2009 at 07:38:03PM +0100, Juan Quintela wrote: >> "Michael S. Tsirkin" wrote: > I expect it fits in practice. > But you should range check the value and fail migration on error. > >> That is only >> needed for old versions that we are reading (get_*

[Qemu-devel] Re: [PATCH 33/41] virtio-net: port to vmstate

2009-12-02 Thread Juan Quintela
"Michael S. Tsirkin" wrote: > On Wed, Dec 02, 2009 at 01:04:31PM +0100, Juan Quintela wrote: >> >> Signed-off-by: Juan Quintela >> --- >> hw/virtio-net.c | 148 >> --- >> 1 files changed, 64 insertions(+), 84 deletions(-) >> >> diff --git a

[Qemu-devel] Re: [PATCH 33/41] virtio-net: port to vmstate

2009-12-02 Thread Michael S. Tsirkin
On Wed, Dec 02, 2009 at 07:38:03PM +0100, Juan Quintela wrote: > "Michael S. Tsirkin" wrote: > > On Wed, Dec 02, 2009 at 01:04:31PM +0100, Juan Quintela wrote: > >> > >> Signed-off-by: Juan Quintela > >> --- > >> hw/virtio-net.c | 148 > >> -

[Qemu-devel] Re: [PATCH 33/41] virtio-net: port to vmstate

2009-12-02 Thread Michael S. Tsirkin
On Wed, Dec 02, 2009 at 01:04:31PM +0100, Juan Quintela wrote: > > Signed-off-by: Juan Quintela > --- > hw/virtio-net.c | 148 > --- > 1 files changed, 64 insertions(+), 84 deletions(-) > > diff --git a/hw/virtio-net.c b/hw/virtio-net.c > in

[Qemu-devel] Re: [PATCH 33/41] virtio-net: port to vmstate

2009-12-02 Thread Juan Quintela
"Michael S. Tsirkin" wrote: > On Wed, Dec 02, 2009 at 01:04:31PM +0100, Juan Quintela wrote: >> >> Signed-off-by: Juan Quintela >> --- >> hw/virtio-net.c | 148 >> --- >> 1 files changed, 64 insertions(+), 84 deletions(-) >> >> diff --git a

[Qemu-devel] Re: [PATCH 33/41] virtio-net: port to vmstate

2009-12-02 Thread Michael S. Tsirkin
On Wed, Dec 02, 2009 at 01:04:31PM +0100, Juan Quintela wrote: > > Signed-off-by: Juan Quintela > --- > hw/virtio-net.c | 148 > --- > 1 files changed, 64 insertions(+), 84 deletions(-) > > diff --git a/hw/virtio-net.c b/hw/virtio-net.c > in