[Xen-devel] [PATCH] Fix the KDD_LOG statements to use appropriate format specifier for printing uint64_t

Julian Tuminaro posted 1 patch 1 week ago
Failed in applying to current master (apply log)
tools/debugger/kdd/kdd.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

[Xen-devel] [PATCH] Fix the KDD_LOG statements to use appropriate format specifier for printing uint64_t

Posted by Julian Tuminaro 1 week ago
Previous commit in kdd.c had a small issue which lead to warning/error while compiling
on 32-bit systems due to mismatch of type size while doing type cast from uint64_t to
void *

Signed-off-by: Jenish Rakholiya <rjenish@cmu.edu>
Signed-off-by: Julian Tuminaro <jtuminar@andrew.cmu.edu>
---
 tools/debugger/kdd/kdd.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/debugger/kdd/kdd.c b/tools/debugger/kdd/kdd.c
index 6d3febefda..3ebda9b12c 100644
--- a/tools/debugger/kdd/kdd.c
+++ b/tools/debugger/kdd/kdd.c
@@ -613,7 +613,7 @@ static void get_os_info_64(kdd_state *s)
     idt0_addr |= ((buf >> 32) & 0xffff0000);
     idt0_addr |= (buf & 0xffff);
 
-    KDD_LOG(s, "idt0 addr: %p\n", (void *)idt0_addr);
+    KDD_LOG(s, "idt0 addr: 0x%"PRIx64"\n", idt0_addr);
 
     /*
      * get the page start and look for "MZ" file header - we limit the search
@@ -621,7 +621,6 @@ static void get_os_info_64(kdd_state *s)
      */
 
     base = idt0_addr & ~(PAGE_SIZE - 1);
-    KDD_LOG(s, "%p\n", (void *)base);
 
     while (search_limit) {
         uint16_t val;
@@ -638,7 +637,7 @@ static void get_os_info_64(kdd_state *s)
         search_limit -= 1;
     }
 
-    KDD_LOG(s, "base: %p\n", (void *)base);
+    KDD_LOG(s, "base: 0x%"PRIx64"\n", base);
 
     /* found the data section start */
     if (get_pe64_sections(s, base, ".data", &data_base, &data_size))
@@ -689,9 +688,9 @@ static void get_os_info_64(kdd_state *s)
     if (caddr < data_base + data_size) {
         /* if found, set the field and return */
 
-        KDD_LOG(s, "base: %p\n", (void *)base);
-        KDD_LOG(s, "modules list: %p\n", (void *)modptr);
-        KDD_LOG(s, "kddl: %p\n", (void *)kddl);
+        KDD_LOG(s, "base: 0x%"PRIx64"\n", base);
+        KDD_LOG(s, "modules list: 0x%"PRIx64"\n", modptr);
+        KDD_LOG(s, "kddl: 0x%"PRIx64"\n", kddl);
         KDD_LOG(s, "minor version: 0x%hx\n", minor);
 
         s->os.base = base;
-- 
2.17.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH] Fix the KDD_LOG statements to use appropriate format specifier for printing uint64_t

Posted by Wei Liu 6 days ago
On Sat, Nov 30, 2019 at 03:11:18AM -0500, Julian Tuminaro wrote:
> Previous commit in kdd.c had a small issue which lead to warning/error while compiling
> on 32-bit systems due to mismatch of type size while doing type cast from uint64_t to
> void *
> 
> Signed-off-by: Jenish Rakholiya <rjenish@cmu.edu>
> Signed-off-by: Julian Tuminaro <jtuminar@andrew.cmu.edu>
> ---
>  tools/debugger/kdd/kdd.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/debugger/kdd/kdd.c b/tools/debugger/kdd/kdd.c
> index 6d3febefda..3ebda9b12c 100644
> --- a/tools/debugger/kdd/kdd.c
> +++ b/tools/debugger/kdd/kdd.c
> @@ -613,7 +613,7 @@ static void get_os_info_64(kdd_state *s)
>      idt0_addr |= ((buf >> 32) & 0xffff0000);
>      idt0_addr |= (buf & 0xffff);
>  
> -    KDD_LOG(s, "idt0 addr: %p\n", (void *)idt0_addr);
> +    KDD_LOG(s, "idt0 addr: 0x%"PRIx64"\n", idt0_addr);
>  
>      /*
>       * get the page start and look for "MZ" file header - we limit the search
> @@ -621,7 +621,6 @@ static void get_os_info_64(kdd_state *s)
>       */
>  
>      base = idt0_addr & ~(PAGE_SIZE - 1);
> -    KDD_LOG(s, "%p\n", (void *)base);

Did you actually intend to delete this line?

Anyway, I have pushed this patch with Tim's ack to unblock our CI.

If you want to add this back, please submit another patch.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH] Fix the KDD_LOG statements to use appropriate format specifier for printing uint64_t

Posted by Tim Deegan 6 days ago
At 03:11 -0500 on 30 Nov (1575083478), Julian Tuminaro wrote:
> Previous commit in kdd.c had a small issue which lead to warning/error while compiling
> on 32-bit systems due to mismatch of type size while doing type cast from uint64_t to
> void *
> 
> Signed-off-by: Jenish Rakholiya <rjenish@cmu.edu>
> Signed-off-by: Julian Tuminaro <jtuminar@andrew.cmu.edu>

Acked-by: Tim Deegan <tim@xen.org>

Thanks for the fix!

Tim.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel