[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 3/4] tools/libxc: Avoid generating inappropriate zero-length records
It was never intended for records such as these to be sent with zero content. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> CC: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/libxc/xc_sr_save_x86_hvm.c | 4 ++++ tools/libxc/xc_sr_save_x86_pv.c | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/tools/libxc/xc_sr_save_x86_hvm.c b/tools/libxc/xc_sr_save_x86_hvm.c index ba50a43..5401bf9 100644 --- a/tools/libxc/xc_sr_save_x86_hvm.c +++ b/tools/libxc/xc_sr_save_x86_hvm.c @@ -112,6 +112,10 @@ static int write_hvm_params(struct xc_sr_context *ctx) } } + /* No params? Skip this record. */ + if ( hdr.count == 0 ) + return 0; + rc = write_split_record(ctx, &rec, entries, hdr.count * sizeof(*entries)); if ( rc ) PERROR("Failed to write HVM_PARAMS record"); diff --git a/tools/libxc/xc_sr_save_x86_pv.c b/tools/libxc/xc_sr_save_x86_pv.c index 4a29460..5fb9f2f 100644 --- a/tools/libxc/xc_sr_save_x86_pv.c +++ b/tools/libxc/xc_sr_save_x86_pv.c @@ -607,6 +607,10 @@ static int write_one_vcpu_extended(struct xc_sr_context *ctx, uint32_t id) return -1; } + /* No content? Skip the record. */ + if ( domctl.u.ext_vcpucontext.size == 0 ) + return 0; + return write_split_record(ctx, &rec, &domctl.u.ext_vcpucontext, domctl.u.ext_vcpucontext.size); } @@ -662,6 +666,10 @@ static int write_one_vcpu_xsave(struct xc_sr_context *ctx, uint32_t id) goto err; } + /* No xsave state? Skip this record. */ + if ( domctl.u.vcpuextstate.size == 0 ) + goto out; + rc = write_split_record(ctx, &rec, buffer, domctl.u.vcpuextstate.size); if ( rc ) goto err; @@ -728,6 +736,10 @@ static int write_one_vcpu_msrs(struct xc_sr_context *ctx, uint32_t id) goto err; } + /* No MSRs? Skip this record. */ + if ( domctl.u.vcpu_msrs.msr_count == 0 ) + goto out; + rc = write_split_record(ctx, &rec, buffer, domctl.u.vcpu_msrs.msr_count * sizeof(xen_domctl_vcpu_msr_t)); -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |