Skip to contentSkip to conversation

fuzz: Display hexadecimal value with '0x' prefix

PATCH In review Philippe Mathieu-Daudé 5 participants 5 messages Jun 12, 2021 – Jun 13, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 fuzz: Display hexadecimal value with '0x' prefix

Use memory_region_size() to get the MemoryRegion size, and display it with the '0x' prefix.

---
v2:
- Use PRIx64 (lvivier)
- Use memory_region_size()

---
 tests/qtest/fuzz/generic_fuzz.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/qtest/fuzz/generic_fuzz.c +2 -2
index cea7d4058e8..6c675227174 100644
@@ -841,9 +841,9 @@ static void generic_pre_fuzz(QTestState *s)
 
     g_hash_table_iter_init(&iter, fuzzable_memoryregions);
     while (g_hash_table_iter_next(&iter, (gpointer)&mr, NULL)) {
-        printf("  * %s (size %lx)\n",
+        printf("  * %s (size 0x%" PRIx64 ")\n",
                object_get_canonical_path_component(&(mr->parent_obj)),
-               (uint64_t)mr->size);
+               memory_region_size(mr));
     }
 
     if (!g_hash_table_size(fuzzable_memoryregions)) {
Signature · 1 line
2.31.1
Reviewed-by on v2 1/1
#2 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 11 lines · Philippe Mathieu-Daudé

Use memory_region_size() to get the MemoryRegion size, and display it with the '0x' prefix.

---
v2:
- Use PRIx64 (lvivier)
- Use memory_region_size()

---
 tests/qtest/fuzz/generic_fuzz.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Thanks!

Reviewed-by on v2 1/1
#3 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 19 lines · Philippe Mathieu-Daudé

Use memory_region_size() to get the MemoryRegion size, and display it with the '0x' prefix.

---
v2:
- Use PRIx64 (lvivier)
- Use memory_region_size()

---
  tests/qtest/fuzz/generic_fuzz.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
tests/qtest/fuzz/generic_fuzz.c +0 -0
index cea7d4058e8..6c675227174 100644
@@ -841,9 +841,9 @@ static void generic_pre_fuzz(QTestState *s)
 

tests/qtest/fuzz/generic_fuzz.c static void generic_pre_fuzz(QTestState *s) · line 849

Quoted 10 lines
tests/qtest/fuzz/generic_fuzz.c +2 -2
      g_hash_table_iter_init(&iter, fuzzable_memoryregions);
      while (g_hash_table_iter_next(&iter, (gpointer)&mr, NULL)) {
-        printf("  * %s (size %lx)\n",
+        printf("  * %s (size 0x%" PRIx64 ")\n",
                 object_get_canonical_path_component(&(mr->parent_obj)),
-               (uint64_t)mr->size);
+               memory_region_size(mr));
      }
 
      if (!g_hash_table_size(fuzzable_memoryregions)) {
Reviewed-by on v2 1/1
#4 lore raw
In reply to Philippe Mathieu-Daudé

Le 12/06/2021 à 21:58, Philippe Mathieu-Daudé a écrit :

Quoted 19 lines

Use memory_region_size() to get the MemoryRegion size, and display it with the '0x' prefix.

---
v2:
- Use PRIx64 (lvivier)
- Use memory_region_size()

---
 tests/qtest/fuzz/generic_fuzz.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/qtest/fuzz/generic_fuzz.c +0 -0
index cea7d4058e8..6c675227174 100644
@@ -841,9 +841,9 @@ static void generic_pre_fuzz(QTestState *s)
 

tests/qtest/fuzz/generic_fuzz.c static void generic_pre_fuzz(QTestState *s) · line 849

Quoted 10 lines
tests/qtest/fuzz/generic_fuzz.c +2 -2
     g_hash_table_iter_init(&iter, fuzzable_memoryregions);
     while (g_hash_table_iter_next(&iter, (gpointer)&mr, NULL)) {
-        printf("  * %s (size %lx)\n",
+        printf("  * %s (size 0x%" PRIx64 ")\n",
                object_get_canonical_path_component(&(mr->parent_obj)),
-               (uint64_t)mr->size);
+               memory_region_size(mr));
     }
 
     if (!g_hash_table_size(fuzzable_memoryregions)) {