diff mbox

libxc: correct error message in xc_sr_common.c

Message ID 20170810112428.5769-1-jgross@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jürgen Groß Aug. 10, 2017, 11:24 a.m. UTC
When the record length for sending the p2m frames in a migration
stream is too large, the issued error message is not very helpful:

xc: Record (0x00000003, x86 PV P2M frames) length 0x8 exceeds max
    (0x800000): Internal error

When printing the error use the size which was tested instead that of
the record header length.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 tools/libxc/xc_sr_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Andrew Cooper Aug. 10, 2017, 12:04 p.m. UTC | #1
On 10/08/17 12:24, Juergen Gross wrote:
> When the record length for sending the p2m frames in a migration
> stream is too large, the issued error message is not very helpful:
>
> xc: Record (0x00000003, x86 PV P2M frames) length 0x8 exceeds max
>     (0x800000): Internal error
>
> When printing the error use the size which was tested instead that of
> the record header length.
>
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

This is a side effect of how the function was restructured during
original development.

> ---
>  tools/libxc/xc_sr_common.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/libxc/xc_sr_common.c b/tools/libxc/xc_sr_common.c
> index 48fa676f4e..79b9c3e940 100644
> --- a/tools/libxc/xc_sr_common.c
> +++ b/tools/libxc/xc_sr_common.c
> @@ -71,8 +71,8 @@ int write_split_record(struct xc_sr_context *ctx, struct xc_sr_record *rec,
>  
>      if ( record_length > REC_LENGTH_MAX )
>      {
> -        ERROR("Record (0x%08x, %s) length %#x exceeds max (%#x)", rec->type,
> -              rec_type_to_str(rec->type), rec->length, REC_LENGTH_MAX);
> +        ERROR("Record (0x%08x, %s) length %#zx exceeds max (%#x)", rec->type,
> +              rec_type_to_str(rec->type), record_length, REC_LENGTH_MAX);
>          return -1;
>      }
>
Wei Liu Aug. 10, 2017, 1:40 p.m. UTC | #2
On Thu, Aug 10, 2017 at 01:24:27PM +0200, Juergen Gross wrote:
> When the record length for sending the p2m frames in a migration
> stream is too large, the issued error message is not very helpful:
> 
> xc: Record (0x00000003, x86 PV P2M frames) length 0x8 exceeds max
>     (0x800000): Internal error
> 
> When printing the error use the size which was tested instead that of
> the record header length.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>
diff mbox

Patch

diff --git a/tools/libxc/xc_sr_common.c b/tools/libxc/xc_sr_common.c
index 48fa676f4e..79b9c3e940 100644
--- a/tools/libxc/xc_sr_common.c
+++ b/tools/libxc/xc_sr_common.c
@@ -71,8 +71,8 @@  int write_split_record(struct xc_sr_context *ctx, struct xc_sr_record *rec,
 
     if ( record_length > REC_LENGTH_MAX )
     {
-        ERROR("Record (0x%08x, %s) length %#x exceeds max (%#x)", rec->type,
-              rec_type_to_str(rec->type), rec->length, REC_LENGTH_MAX);
+        ERROR("Record (0x%08x, %s) length %#zx exceeds max (%#x)", rec->type,
+              rec_type_to_str(rec->type), record_length, REC_LENGTH_MAX);
         return -1;
     }