[PATCH 2/5] disas/nanomips: Fix invalid PRIx64 format calling img_format()

Philippe Mathieu-Daudé posted 5 patches 3 years, 1 month ago
Maintainers: "Philippe Mathieu-Daudé" <philmd@linaro.org>, Aurelien Jarno <aurelien@aurel32.net>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>
[PATCH 2/5] disas/nanomips: Fix invalid PRIx64 format calling img_format()
Posted by Philippe Mathieu-Daudé 3 years, 1 month ago
Fix:

  disas/nanomips.c:12231:62: warning: format specifies type 'char *' but the argument has type 'uint64' (aka 'unsigned long long') [-Wformat]
    return img_format("RESTOREF 0x%" PRIx64 ", %s", u_value, count_value);
                                               ~~            ^~~~~~~~~~~
                                               %llu

Fixes: 4066c152b3 ("disas/nanomips: Remove IMMEDIATE functions")
Reported-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 disas/nanomips.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/disas/nanomips.c b/disas/nanomips.c
index 6466c80dc5..e4b21e7c45 100644
--- a/disas/nanomips.c
+++ b/disas/nanomips.c
@@ -12235,7 +12235,8 @@ static char *RESTOREF(uint64 instruction, Dis_info *info)
     uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3__s3(instruction);
 
 
-    return img_format("RESTOREF 0x%" PRIx64 ", %s", u_value, count_value);
+    return img_format("RESTOREF 0x%" PRIx64 ", 0x%" PRIx64,
+                      u_value, count_value);
 }
 
 
-- 
2.37.3


Re: [PATCH 2/5] disas/nanomips: Fix invalid PRIx64 format calling img_format()
Posted by Stefan Weil via 3 years, 1 month ago
Am 01.11.22 um 12:44 schrieb Philippe Mathieu-Daudé:

> Fix:
>
>    disas/nanomips.c:12231:62: warning: format specifies type 'char *' but the argument has type 'uint64' (aka 'unsigned long long') [-Wformat]
>      return img_format("RESTOREF 0x%" PRIx64 ", %s", u_value, count_value);
>                                                 ~~            ^~~~~~~~~~~
>                                                 %llu
>
> Fixes: 4066c152b3 ("disas/nanomips: Remove IMMEDIATE functions")
> Reported-by: Stefan Weil <sw@weilnetz.de>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   disas/nanomips.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/disas/nanomips.c b/disas/nanomips.c
> index 6466c80dc5..e4b21e7c45 100644
> --- a/disas/nanomips.c
> +++ b/disas/nanomips.c
> @@ -12235,7 +12235,8 @@ static char *RESTOREF(uint64 instruction, Dis_info *info)
>       uint64 u_value = extract_u_11_10_9_8_7_6_5_4_3__s3(instruction);
>   
>   
> -    return img_format("RESTOREF 0x%" PRIx64 ", %s", u_value, count_value);
> +    return img_format("RESTOREF 0x%" PRIx64 ", 0x%" PRIx64,
> +                      u_value, count_value);
>   }


Reviewed-by: Stefan Weil <sw@weilnetz.de>