Patchwork [v2] arch_init/ram_load: add error message for block length mismatch

login
register
mail settings
Submitter Alon Levy
Date Dec. 6, 2012, 12:08 p.m.
Message ID <1354795700-3052-1-git-send-email-alevy@redhat.com>
Download mbox | patch
Permalink /patch/204213/
State New
Headers show

Comments

Alon Levy - Dec. 6, 2012, 12:08 p.m.
Signed-off-by: Alon Levy <alevy@redhat.com>
---
Please ignore previous version, accidentally removed goto done and used wrong
format size specifiers.

 arch_init.c | 3 +++
 1 file changed, 3 insertions(+)
Orit Wasserman - Dec. 6, 2012, 12:18 p.m.
On 12/06/2012 02:08 PM, Alon Levy wrote:
> Signed-off-by: Alon Levy <alevy@redhat.com>
> ---
> Please ignore previous version, accidentally removed goto done and used wrong
> format size specifiers.
missed that too, but I'm adding better error messages anyway :)
> 
>  arch_init.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch_init.c b/arch_init.c
> index e6effe8..fba24f3 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -808,6 +808,9 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
>                      QLIST_FOREACH(block, &ram_list.blocks, next) {
>                          if (!strncmp(id, block->idstr, sizeof(id))) {
>                              if (block->length != length) {
> +                                fprintf(stderr, "Length mismatch: %s: %ld "
> +                                        "in != %ld\n", id, length,
> +                                        block->length);
>                                  ret =  -EINVAL;
>                                  goto done;
>                              }
>
Stefan Hajnoczi - Dec. 18, 2012, 4 p.m.
On Thu, Dec 06, 2012 at 02:08:20PM +0200, Alon Levy wrote:
> Signed-off-by: Alon Levy <alevy@redhat.com>
> ---
> Please ignore previous version, accidentally removed goto done and used wrong
> format size specifiers.
> 
>  arch_init.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch_init.c b/arch_init.c
> index e6effe8..fba24f3 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -808,6 +808,9 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
>                      QLIST_FOREACH(block, &ram_list.blocks, next) {
>                          if (!strncmp(id, block->idstr, sizeof(id))) {
>                              if (block->length != length) {
> +                                fprintf(stderr, "Length mismatch: %s: %ld "
> +                                        "in != %ld\n", id, length,
> +                                        block->length);

Please use RAM_ADDR_FMT for ram_addr_t values.

Stefan

Patch

diff --git a/arch_init.c b/arch_init.c
index e6effe8..fba24f3 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -808,6 +808,9 @@  static int ram_load(QEMUFile *f, void *opaque, int version_id)
                     QLIST_FOREACH(block, &ram_list.blocks, next) {
                         if (!strncmp(id, block->idstr, sizeof(id))) {
                             if (block->length != length) {
+                                fprintf(stderr, "Length mismatch: %s: %ld "
+                                        "in != %ld\n", id, length,
+                                        block->length);
                                 ret =  -EINVAL;
                                 goto done;
                             }