[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/14] disas/nanomips: Fix invalid PRId64 format calling img_forma
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 06/14] disas/nanomips: Fix invalid PRId64 format calling img_format() |
Date: |
Tue, 8 Nov 2022 00:58:14 +0100 |
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
To avoid crashes such (kernel from commit f375ad6a0d):
$ qemu-system-mipsel -cpu I7200 -d in_asm -kernel generic_nano32r6el_page4k
...
----------------
IN: __bzero
0x805c6084: 20c4 6950 ADDU r13, a0, a2
0x805c6088: 9089 ADDIU a0, 1
Process 70261 stopped
* thread #6, stop reason = EXC_BAD_ACCESS (code=1, address=0xfffffffffffffff0)
frame #0: 0x00000001bfe38864 libsystem_platform.dylib`_platform_strlen + 4
libsystem_platform.dylib`:
-> 0x1bfe38864 <+4>: ldr q0, [x1]
0x1bfe38868 <+8>: adr x3, #-0xc8 ;
___lldb_unnamed_symbol314
0x1bfe3886c <+12>: ldr q2, [x3], #0x10
0x1bfe38870 <+16>: and x2, x0, #0xf
Target 0: (qemu-system-mipsel) stopped.
(lldb) bt
* thread #6, stop reason = EXC_BAD_ACCESS (code=1, address=0xfffffffffffffff0)
* frame #0: 0x00000001bfe38864 libsystem_platform.dylib`_platform_strlen + 4
frame #1: 0x00000001bfce76a0 libsystem_c.dylib`__vfprintf + 4544
frame #2: 0x00000001bfd158b4 libsystem_c.dylib`_vasprintf + 280
frame #3: 0x0000000101c22fb0 libglib-2.0.0.dylib`g_vasprintf + 28
frame #4: 0x0000000101bfb7d8 libglib-2.0.0.dylib`g_strdup_vprintf + 32
frame #5: 0x000000010000fb70
qemu-system-mipsel`img_format(format=<unavailable>) at nanomips.c:103:14 [opt]
frame #6: 0x0000000100018868
qemu-system-mipsel`SB_S9_(instruction=<unavailable>, info=<unavailable>) at
nanomips.c:12616:12 [opt]
frame #7: 0x000000010000f90c qemu-system-mipsel`print_insn_nanomips at
nanomips.c:589:28 [opt]
Fixes: 4066c152b3 ("disas/nanomips: Remove IMMEDIATE functions")
Reported-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20221101114458.25756-2-philmd@linaro.org>
---
disas/nanomips.c | 35 ++++++++++++++++++++---------------
1 file changed, 20 insertions(+), 15 deletions(-)
diff --git a/disas/nanomips.c b/disas/nanomips.c
index 9647f1a8e3..6466c80dc5 100644
--- a/disas/nanomips.c
+++ b/disas/nanomips.c
@@ -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);
}
--
2.38.1
- [PULL 00/14] MIPS patches for 2022-11-08, Philippe Mathieu-Daudé, 2022/11/07
- [PULL 02/14] target/mips: Cast offset field of Octeon BBIT to int16_t, Philippe Mathieu-Daudé, 2022/11/07
- [PULL 01/14] target/mips: Set CP0St_{KX, SX, UX} for Loongson-2F, Philippe Mathieu-Daudé, 2022/11/07
- [PULL 03/14] target/mips: Enable LBX/LWX/* instructions for Octeon, Philippe Mathieu-Daudé, 2022/11/07
- [PULL 04/14] target/mips: Disable DSP ASE for Octeon68XX, Philippe Mathieu-Daudé, 2022/11/07
- [PULL 05/14] target/mips: Don't check COP1X for 64 bit FP mode, Philippe Mathieu-Daudé, 2022/11/07
- [PULL 06/14] disas/nanomips: Fix invalid PRId64 format calling img_format(),
Philippe Mathieu-Daudé <=
- [PULL 07/14] disas/nanomips: Fix invalid PRIx64 format calling img_format(), Philippe Mathieu-Daudé, 2022/11/07
- [PULL 08/14] disas/nanomips: Use G_GNUC_PRINTF to avoid invalid string formats, Philippe Mathieu-Daudé, 2022/11/07
- [PULL 09/14] disas/nanomips: Remove headers already included by "qemu/osdep.h", Philippe Mathieu-Daudé, 2022/11/07
- [PULL 10/14] disas/nanomips: Move setjmp into nanomips_dis, Philippe Mathieu-Daudé, 2022/11/07
- [PULL 11/14] disas/nanomips: Merge insn{1,2,3} into words[3], Philippe Mathieu-Daudé, 2022/11/07
- [PULL 12/14] disas/nanomips: Split out read_u16, Philippe Mathieu-Daudé, 2022/11/07
- [PULL 13/14] disas/nanomips: Tidy read for 48-bit opcodes, Philippe Mathieu-Daudé, 2022/11/07
- [PULL 14/14] MAINTAINERS: Inherit from nanoMIPS, Philippe Mathieu-Daudé, 2022/11/07
- Re: [PULL 00/14] MIPS patches for 2022-11-08, Stefan Hajnoczi, 2022/11/08