Skip to contentSkip to conversation

arch_init/ram_load: add error message for block length mismatch

PATCH Superseded Alon Levy 3 participants 6 messages Dec 6, 2012 – Dec 18, 2012

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Alon Levy

author
#0 lore raw

PATCH 1/1 arch_init/ram_load: add error message for block length mismatch

---
 arch_init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch_init.c +3 -1
index e6effe8..84bca99 100644
@@ -808,8 +808,10 @@ 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: %d "
+                                        "in != %d\n", id, length,
+                                        block->length);
                                 ret =  -EINVAL;
-                                goto done;
                             }
                             break;
                         }
Signature · 1 line
1.8.0.1
author
#1 lore raw

PATCH v2 1/1 arch_init/ram_load: add error message for block length mismatch

---
Please ignore previous version, accidentally removed goto done and used wrong format size specifiers.

 arch_init.c | 3 +++
 1 file changed, 3 insertions(+)
arch_init.c +3 -0
index e6effe8..fba24f3 100644
@@ -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;
                             }
Signature · 1 line
1.8.0.1
#2 lore raw
Quoted 4 lines · Alon Levy

---
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 :)

Quoted 19 lines
 arch_init.c | 3 +++
 1 file changed, 3 insertions(+)
arch_init.c +3 -0
index e6effe8..fba24f3 100644
@@ -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;
                             }
#3 lore raw
In reply to Alon Levy
Quoted 13 lines · Alon Levy

---
Please ignore previous version, accidentally removed goto done and used wrong format size specifiers.

 arch_init.c | 3 +++
 1 file changed, 3 insertions(+)
arch_init.c +0 -0
index e6effe8..fba24f3 100644

arch_init.c static int ram_load(QEMUFile *f, void *opaque, int version_id) · line 813

Quoted 6 lines
arch_init.c +3 -0
@@ -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

Reviewed-by on v1 1/1
#4 lore raw
In reply to Alon Levy
Quoted 12 lines · Alon Levy
---
 arch_init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch_init.c +0 -0
index e6effe8..84bca99 100644
@@ -808,8 +808,10 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
                     QLIST_FOREACH(block, &ram_list.blocks, next) {

arch_init.c static int ram_load(QEMUFile *f, void *opaque, int version_id) · line 817

Quoted 10 lines
arch_init.c +3 -1
                         if (!strncmp(id, block->idstr, sizeof(id))) {
                             if (block->length != length) {
+                                fprintf(stderr, "Length mismatch: %s: %d "
+                                        "in != %d\n", id, length,
+                                        block->length);
                                 ret =  -EINVAL;
-                                goto done;
                             }
                             break;
                         }

But the real question is what did we break this time? can it be fixed?

Orit

author
#5 lore raw
Quoted 28 lines · Alon Levy
Quoted 18 lines
---
 arch_init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch_init.c +1 -0
index e6effe8..84bca99 100644
@@ -808,8 +808,10 @@ 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: %d "

arch_init.c static int ram_load(QEMUFile *f, void *opaque, int version_id) · line 817

Quoted 7 lines
arch_init.c +2 -1
+                                        "in != %d\n", id, length,
+                                        block->length);
                                 ret =  -EINVAL;
-                                goto done;
                             }
                             break;
                         }
Quoted 2 lines

But the real question is what did we break this time? can it be fixed?

qxl - we changed the rom bar size for all revisions of the device. I'm checking the upstream fix and will send it when I'm happy.

Quoted 4 lines

Orit