[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [BUGFIX][PATCH 4/4] hvm_save_one: allow the 2nd instance to be fetched for PIC.
From: Don Slutz <dslutz@xxxxxxxxxxx> In this case hvm_sr_handlers[typecode].size is 2x the struct size. So use the saved size (length) to look at each possible instance. Signed-off-by: Don Slutz <dslutz@xxxxxxxxxxx> --- xen/common/hvm/save.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/xen/common/hvm/save.c b/xen/common/hvm/save.c index ff6e910..f4138b4 100644 --- a/xen/common/hvm/save.c +++ b/xen/common/hvm/save.c @@ -98,9 +98,6 @@ int hvm_save_one(struct domain *d, uint16_t typecode, uint16_t instance, else sz = hvm_sr_handlers[typecode].size; - if ( (instance + 1) * hvm_sr_handlers[typecode].size > sz ) - return -EINVAL; - ctxt.size = sz; ctxt.data = xmalloc_bytes(sz); if ( !ctxt.data ) @@ -114,20 +111,20 @@ int hvm_save_one(struct domain *d, uint16_t typecode, uint16_t instance, } else { - uint32_t off; + uint32_t off, add; rv = -EBADSLT; - for (off = 0; off < ctxt.cur; off += hvm_sr_handlers[typecode].size) { + for (off = 0; off < ctxt.cur; off += add + sizeof (struct hvm_save_descriptor)) { struct hvm_save_descriptor *desc = (struct hvm_save_descriptor *)&ctxt.data[off]; + add = desc->length; if (instance == desc->instance) { rv = 0; if ( copy_to_guest(handle, ctxt.data + off + sizeof (struct hvm_save_descriptor), - hvm_sr_handlers[typecode].size - - sizeof (struct hvm_save_descriptor)) ) + add) ) rv = -EFAULT; break; } -- 1.8.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |