Skip to contentSkip to conversation

Fix type of cluster_index

PATCH Superseded Stefan Weil 1 participant 1 message Apr 9, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix type of cluster_index

From: Stefan Weil <[email protected]>

The type should be the same as the type of cluster_id.

This fixed a runtime error reported by sanitizers:

/qemu/include/exec/tb-lookup.h:33:35: runtime error: left shift of negative value -1 /qemu/accel/tcg/translate-all.c:1692:34: runtime error: left shift of negative value -1

---
 include/qom/cpu.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/qom/cpu.h +2 -2
index 1d6099e5d4..6a753caed7 100644
@@ -422,7 +422,7 @@ struct CPUState {
 
     /* TODO Move common fields from CPUArchState here. */
     int cpu_index;
-    int cluster_index;
+    uint32_t cluster_index;
     uint32_t halted;
     uint32_t can_do_io;
     int32_t exception_index;
@@ -1129,6 +1129,6 @@ extern const struct VMStateDescription vmstate_cpu_common;
 #endif /* NEED_CPU_H */
 
 #define UNASSIGNED_CPU_INDEX -1
-#define UNASSIGNED_CLUSTER_INDEX -1
+#define UNASSIGNED_CLUSTER_INDEX UINT32_MAX
 
 #endif
Signature · 1 line
2.11.0