disas/nanomips: Format string fixes
cover disas/nanomips: Format string fixes
Fix invalid string formats reported by Stefan:
https://lore.kernel.org/qemu-devel/[email protected]/
Philippe Mathieu-Daudé (5):
disas/nanomips: Fix invalid PRId64 format calling img_format() disas/nanomips: Fix invalid PRIx64 format calling img_format() disas/nanomips: Use G_GNUC_PRINTF to avoid invalid string formats disas/nanomips: Remove headers already included by "qemu/osdep.h"
MAINTAINERS: Inherit from nanoMIPS
MAINTAINERS | 8 +------- disas/nanomips.c | 44 +++++++++++++++++++++++--------------------- 2 files changed, 24 insertions(+), 28 deletions(-)
Signature · 1 line
2.37.3
PATCH 1/5 disas/nanomips: Fix invalid PRId64 format calling img_format()
Fix warnings such:
disas/nanomips.c:3251:64: warning: format specifies type 'char *' but the argument has type 'int64' (aka 'long long') [-Wformat]
return img_format("CACHE 0x%" PRIx64 ", %s(%s)", op_value, s_value, rs);
~~ ^~~~~~~
%lld--- disas/nanomips.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-)
disas/nanomips.c +20 -15
@@ -3252,7 +3252,8 @@ static char *CACHE(uint64 instruction, Dis_info *info)const char *rs =GPR (rs_value, info); -return img_format ("CACHE 0x%" PRIx64", %s(%s)" , op_value, s_value, rs); +return img_format ("CACHE 0x%" PRIx64", %" PRId64"(%s)" , + op_value, s_value, rs); }
@@ -3274,7 +3275,8 @@ static char *CACHEE(uint64 instruction, Dis_info *info)const char *rs =GPR (rs_value, info); -return img_format ("CACHEE 0x%" PRIx64", %s(%s)" , op_value, s_value, rs); +return img_format ("CACHEE 0x%" PRIx64", %" PRId64"(%s)" , + op_value, s_value, rs); }
@@ -5173,7 +5175,7 @@ static char *DADDIU_48_(uint64 instruction, Dis_info *info)const char *rt =GPR (rt_value, info); -return img_format ("DADDIU %s, %s" , rt, s_value); +return img_format ("DADDIU %s, %" PRId64, rt, s_value); }
@@ -11859,7 +11861,7 @@ static char *PREF_S9_(uint64 instruction, Dis_info *info)const char *rs =GPR (rs_value, info); -return img_format ("PREF 0x%" PRIx64", %s(%s)" , +return img_format ("PREF 0x%" PRIx64", %" PRId64"(%s)" , hint_value, s_value, rs); }
@@ -11905,7 +11907,8 @@ static char *PREFE(uint64 instruction, Dis_info *info)const char *rs =GPR (rs_value, info); -return img_format ("PREFE 0x%" PRIx64", %s(%s)" , hint_value, s_value, rs); +return img_format ("PREFE 0x%" PRIx64", %" PRId64"(%s)" , + hint_value, s_value, rs); }
@@ -12079,7 +12082,7 @@ static char *REPL_PH(uint64 instruction, Dis_info *info)const char *rt =GPR (rt_value, info); -return img_format ("REPL.PH %s, %s" , rt, s_value); +return img_format ("REPL.PH %s, %" PRId64, rt, s_value); }
@@ -12613,7 +12616,7 @@ static char *SB_S9_(uint64 instruction, Dis_info *info)const char *rt =GPR (rt_value, info);const char *rs =GPR (rs_value, info); -return img_format ("SB %s, %s(%s)" , rt, s_value, rs); +return img_format ("SB %s, %" PRId64"(%s)" , rt, s_value, rs); }
@@ -12659,7 +12662,7 @@ static char *SBE(uint64 instruction, Dis_info *info)const char *rt =GPR (rt_value, info);const char *rs =GPR (rs_value, info); -return img_format ("SBE %s, %s(%s)" , rt, s_value, rs); +return img_format ("SBE %s, %" PRId64"(%s)" , rt, s_value, rs); }
@@ -12706,7 +12709,7 @@ static char *SC(uint64 instruction, Dis_info *info)const char *rt =GPR (rt_value, info);const char *rs =GPR (rs_value, info); -return img_format ("SC %s, %s(%s)" , rt, s_value, rs); +return img_format ("SC %s, %" PRId64"(%s)" , rt, s_value, rs); }
@@ -12729,7 +12732,7 @@ static char *SCD(uint64 instruction, Dis_info *info)const char *rt =GPR (rt_value, info);const char *rs =GPR (rs_value, info); -return img_format ("SCD %s, %s(%s)" , rt, s_value, rs); +return img_format ("SCD %s, %" PRId64"(%s)" , rt, s_value, rs); }
@@ -12776,7 +12779,7 @@ static char *SCE(uint64 instruction, Dis_info *info)const char *rt =GPR (rt_value, info);const char *rs =GPR (rs_value, info); -return img_format ("SCE %s, %s(%s)" , rt, s_value, rs); +return img_format ("SCE %s, %" PRId64"(%s)" , rt, s_value, rs); }
@@ -12868,7 +12871,7 @@ static char *SD_S9_(uint64 instruction, Dis_info *info)const char *rt =GPR (rt_value, info);const char *rs =GPR (rs_value, info); -return img_format ("SD %s, %s(%s)" , rt, s_value, rs); +return img_format ("SD %s, %" PRId64"(%s)" , rt, s_value, rs); }
@@ -12973,7 +12976,7 @@ static char *SDC1_S9_(uint64 instruction, Dis_info *info)const char *ft =FPR (ft_value, info);const char *rs =GPR (rs_value, info); -return img_format ("SDC1 %s, %s(%s)" , ft, s_value, rs); +return img_format ("SDC1 %s, %" PRId64"(%s)" , ft, s_value, rs); }
@@ -13066,7 +13069,8 @@ static char *SDC2(uint64 instruction, Dis_info *info)const char *rs =GPR (rs_value, info); -return img_format ("SDC2 CP%" PRIu64", %s(%s)" , cs_value, s_value, rs); +return img_format ("SDC2 CP%" PRIu64", %" PRId64"(%s)" , + cs_value, s_value, rs); }
@@ -13091,7 +13095,8 @@ static char *SDM(uint64 instruction, Dis_info *info)const char *rs =GPR (rs_value, info);uint64 count3 =encode_count3_from_count (count3_value); -return img_format ("SDM %s, %s(%s), 0x%" PRIx64, rt, s_value, rs, count3); +return img_format ("SDM %s, %" PRId64"(%s), 0x%" PRIx64, + rt, s_value, rs, count3); }
Signature · 1 line
2.37.3
Re: [PATCH 1/5] disas/nanomips: Fix invalid PRId64 format calling img_format()
Am 01.11.22 um 12:44 schrieb Philippe Mathieu-Daudé:
Quoted 11 lines
Fix warnings such:
disas/nanomips.c:3251:64: warning: format specifies type 'char *' but the argument has type 'int64' (aka 'long long') [-Wformat] return img_format("CACHE 0x%" PRIx64 ", %s(%s)", op_value, s_value, rs); ~~ ^~~~~~~ %lldFixes 4066c152b3 ("disas/nanomips: Remove IMMEDIATE functions")Reported-by Stefan Weil <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
Quoted 147 lines
disas/nanomips.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-)disas/nanomips.c +20
-15@@ -3252,7 +3252,8 @@ static char *CACHE(uint64 instruction, Dis_info *info)const char *rs =GPR (rs_value, info); -return img_format ("CACHE 0x%" PRIx64", %s(%s)" , op_value, s_value, rs); +return img_format ("CACHE 0x%" PRIx64", %" PRId64"(%s)" , + op_value, s_value, rs); }@@ -3274,7 +3275,8 @@ static char *CACHEE(uint64 instruction, Dis_info *info)const char *rs =GPR (rs_value, info); -return img_format ("CACHEE 0x%" PRIx64", %s(%s)" , op_value, s_value, rs); +return img_format ("CACHEE 0x%" PRIx64", %" PRId64"(%s)" , + op_value, s_value, rs); }@@ -5173,7 +5175,7 @@ static char *DADDIU_48_(uint64 instruction, Dis_info *info)const char *rt =GPR (rt_value, info); -return img_format ("DADDIU %s, %s" , rt, s_value); +return img_format ("DADDIU %s, %" PRId64, rt, s_value); }@@ -11859,7 +11861,7 @@ static char *PREF_S9_(uint64 instruction, Dis_info *info)const char *rs =GPR (rs_value, info); -return img_format ("PREF 0x%" PRIx64", %s(%s)" , +return img_format ("PREF 0x%" PRIx64", %" PRId64"(%s)" , hint_value, s_value, rs); }@@ -11905,7 +11907,8 @@ static char *PREFE(uint64 instruction, Dis_info *info)const char *rs =GPR (rs_value, info); -return img_format ("PREFE 0x%" PRIx64", %s(%s)" , hint_value, s_value, rs); +return img_format ("PREFE 0x%" PRIx64", %" PRId64"(%s)" , + hint_value, s_value, rs); }@@ -12079,7 +12082,7 @@ static char *REPL_PH(uint64 instruction, Dis_info *info)const char *rt =GPR (rt_value, info); -return img_format ("REPL.PH %s, %s" , rt, s_value); +return img_format ("REPL.PH %s, %" PRId64, rt, s_value); }@@ -12613,7 +12616,7 @@ static char *SB_S9_(uint64 instruction, Dis_info *info)const char *rt =GPR (rt_value, info);const char *rs =GPR (rs_value, info); -return img_format ("SB %s, %s(%s)" , rt, s_value, rs); +return img_format ("SB %s, %" PRId64"(%s)" , rt, s_value, rs); }@@ -12659,7 +12662,7 @@ static char *SBE(uint64 instruction, Dis_info *info)const char *rt =GPR (rt_value, info);const char *rs =GPR (rs_value, info); -return img_format ("SBE %s, %s(%s)" , rt, s_value, rs); +return img_format ("SBE %s, %" PRId64"(%s)" , rt, s_value, rs); }@@ -12706,7 +12709,7 @@ static char *SC(uint64 instruction, Dis_info *info)const char *rt =GPR (rt_value, info);const char *rs =GPR (rs_value, info); -return img_format ("SC %s, %s(%s)" , rt, s_value, rs); +return img_format ("SC %s, %" PRId64"(%s)" , rt, s_value, rs); }@@ -12729,7 +12732,7 @@ static char *SCD(uint64 instruction, Dis_info *info)const char *rt =GPR (rt_value, info);const char *rs =GPR (rs_value, info); -return img_format ("SCD %s, %s(%s)" , rt, s_value, rs); +return img_format ("SCD %s, %" PRId64"(%s)" , rt, s_value, rs); }@@ -12776,7 +12779,7 @@ static char *SCE(uint64 instruction, Dis_info *info)const char *rt =GPR (rt_value, info);const char *rs =GPR (rs_value, info); -return img_format ("SCE %s, %s(%s)" , rt, s_value, rs); +return img_format ("SCE %s, %" PRId64"(%s)" , rt, s_value, rs); }@@ -12868,7 +12871,7 @@ static char *SD_S9_(uint64 instruction, Dis_info *info)const char *rt =GPR (rt_value, info);const char *rs =GPR (rs_value, info); -return img_format ("SD %s, %s(%s)" , rt, s_value, rs); +return img_format ("SD %s, %" PRId64"(%s)" , rt, s_value, rs); }@@ -12973,7 +12976,7 @@ static char *SDC1_S9_(uint64 instruction, Dis_info *info)const char *ft =FPR (ft_value, info);const char *rs =GPR (rs_value, info); -return img_format ("SDC1 %s, %s(%s)" , ft, s_value, rs); +return img_format ("SDC1 %s, %" PRId64"(%s)" , ft, s_value, rs); }@@ -13066,7 +13069,8 @@ static char *SDC2(uint64 instruction, Dis_info *info)const char *rs =GPR (rs_value, info); -return img_format ("SDC2 CP%" PRIu64", %s(%s)" , cs_value, s_value, rs); +return img_format ("SDC2 CP%" PRIu64", %" PRId64"(%s)" , + cs_value, s_value, rs); }@@ -13091,7 +13095,8 @@ static char *SDM(uint64 instruction, Dis_info *info)const char *rs =GPR (rs_value, info);uint64 count3 =encode_count3_from_count (count3_value); -return img_format ("SDM %s, %s(%s), 0x%" PRIx64, rt, s_value, rs, count3); +return img_format ("SDM %s, %" PRId64"(%s), 0x%" PRIx64, + rt, s_value, rs, count3); }
PATCH 2/5 disas/nanomips: Fix invalid PRIx64 format calling img_format()
In reply to 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--- disas/nanomips.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
disas/nanomips.c +2 -1
@@ -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); }
Signature · 1 line
2.37.3
Re: [PATCH 2/5] disas/nanomips: Fix invalid PRIx64 format calling img_format()
Am 01.11.22 um 12:44 schrieb Philippe Mathieu-Daudé:
Quoted 19 lines
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); ~~ ^~~~~~~~~~~ %lluFixes 4066c152b3 ("disas/nanomips: Remove IMMEDIATE functions")Reported-by Stefan Weil <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- disas/nanomips.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)disas/nanomips.c +0
-0
disas/nanomips.c static char *RESTOREF(uint64 instruction, Dis_info *info) · line 12240
Quoted 7 lines
disas/nanomips.c +2
-1@@ -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); }
PATCH 3/5 disas/nanomips: Use G_GNUC_PRINTF to avoid invalid string formats
In reply to Philippe Mathieu-Daudé--- disas/nanomips.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
disas/nanomips.c +1 -1
@@ -95,7 +95,7 @@ typedef struct Pool {#define IMGASSERTONCE (test) -static char *img_format (const char *format, ...) +static char * G_GNUC_PRINTF(1, 2) img_format(const char *format, ...) {char *buffer;va_list args;
Signature · 1 line
2.37.3
Re: [PATCH 3/5] disas/nanomips: Use G_GNUC_PRINTF to avoid invalid string formats
Am 01.11.22 um 12:44 schrieb Philippe Mathieu-Daudé:
Quoted 11 lines
Suggested-by Stefan Weil <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- disas/nanomips.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)disas/nanomips.c +0
-0
disas/nanomips.c typedef struct Pool { · line 101
Quoted 8 lines
disas/nanomips.c +1
-1@@ -95,7 +95,7 @@ typedef struct Pool {#define IMGASSERTONCE (test) -static char *img_format (const char *format, ...) +static char * G_GNUC_PRINTF(1, 2) img_format(const char *format, ...) {char *buffer;va_list args;
PATCH 4/5 disas/nanomips: Remove headers already included by "qemu/osdep.h"
In reply to Philippe Mathieu-Daudé--- disas/nanomips.c | 4 ---- 1 file changed, 4 deletions(-)
disas/nanomips.c +0 -4
@@ -30,10 +30,6 @@#include "qemu/osdep.h" #include "disas/dis-asm.h" -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -typedef int64_t int64 ;typedef uint64_t uint64 ;typedef uint32_t uint32 ;
Signature · 1 line
2.37.3
Re: [PATCH 4/5] disas/nanomips: Remove headers already included by "qemu/osdep.h"
Am 01.11.22 um 12:44 schrieb Philippe Mathieu-Daudé:
Quoted 10 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- disas/nanomips.c | 4 ---- 1 file changed, 4 deletions(-)disas/nanomips.c +0
-0
disas/nanomips.c line 35
Quoted 10 lines
disas/nanomips.c +0
-4@@ -30,10 +30,6 @@#include "qemu/osdep.h" #include "disas/dis-asm.h" -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -typedef int64_t int64 ;typedef uint64_t uint64 ;typedef uint32_t uint32 ;
Removing those three typedefs and replacing the related types would also be good (in another patch).
PATCH 5/5 MAINTAINERS: Inherit from nanoMIPS
In reply to Philippe Mathieu-Daudé6 months ago Stefan Pejic stepped in as nanoMIPS maintainer (see commit a 8e0e23445a "target/mips: Undeprecate nanoMIPS ISA support in QEMU"), however today his email is bouncing:
** Message blocked **
Your message to [email protected] has been blocked. See technical details below for more information.
The response from the remote server was:
550 5.4.1 Recipient address rejected: Access denied. AS(201806281) [DBAEUR03FT030.eop-EUR03.prod.protection.outlook.com]
To avoid unmaintained code, I feel forced to merge this code back with the generic MIPS section.
Historical references:
- https://lore.kernel.org/qemu-devel/TY0PR03MB679726901BD6C6BE40114A2FE2A79@TY0PR03MB6797.apcprd03.prod.outlook.com/
- https://lore.kernel.org/qemu-devel/[email protected]/
Message-Id: <[email protected]>
--- MAINTAINERS | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
MAINTAINERS +1 -7
@@ -237,16 +237,10 @@ R: Jiaxun Yang <[email protected]> R: Aleksandar Rikalo <[email protected]> S: Odd Fixes F: target/mips/ -F: disas/mips.c +F: disas/*mips.c F: docs/system/cpu-models-mips.rst.inc F: tests/tcg/mips/ -MIPS TCG CPUs (nanoMIPS ISA) -M: Stefan Pejic <[email protected]> -S: Maintained -F: disas/nanomips.* -F: target/mips/tcg/*nanomips* - NiosII TCG CPUs M: Chris Wulff <[email protected]> M: Marek Vasut <[email protected]>
Signature · 1 line
2.37.3
Re: [PATCH 5/5] MAINTAINERS: Inherit from nanoMIPS
Quoted 10 lines · Philippe Mathieu-Daudé
6 months ago Stefan Pejic stepped in as nanoMIPS maintainer (see commit a
8e0e23445a"target/mips: Undeprecate nanoMIPS ISA support in QEMU"), however today his email is bouncing:** Message blocked **
Your message to [email protected] has been blocked. See technical details below for more information.
The response from the remote server was:
550 5.4.1 Recipient address rejected: Access denied. AS(201806281) [DBAEUR03FT030.eop-EUR03.prod.protection.outlook.com]
I saw the same bounce message when I CC:-ed him recently, thus:
Quoted 10 lines · Philippe Mathieu-Daudé
Fix invalid string formats reported by Stefan:
https://lore.kernel.org/qemu-devel/[email protected]/Philippe Mathieu-Daudé (5):
disas/nanomips: Fix invalid PRId64 format callingimg_format()disas/nanomips: Fix invalid PRIx64 format callingimg_format()disas/nanomips: UseG_GNUC_PRINTFto avoid invalid string formats disas/nanomips: Remove headers already included by "qemu/osdep.h"
MAINTAINERS: Inherit from nanoMIPS
Quoted 4 lines
MAINTAINERS | 8 +------- disas/nanomips.c | 44 +++++++++++++++++++++++--------------------- 2 files changed, 24 insertions(+), 28 deletions(-)
r~
Philippe Mathieu-Daudé
AppliedQuoted 9 lines · Philippe Mathieu-Daudé
Fix invalid string formats reported by Stefan:
https://lore.kernel.org/qemu-devel/[email protected]/Philippe Mathieu-Daudé (5):
disas/nanomips: Fix invalid PRId64 format callingimg_format()disas/nanomips: Fix invalid PRIx64 format callingimg_format()disas/nanomips: UseG_GNUC_PRINTFto avoid invalid string formats disas/nanomips: Remove headers already included by "qemu/osdep.h"
MAINTAINERS: Inherit from nanoMIPS
Queued to mips-fixes.