Skip to contentSkip to conversation

ppc/vof: Fix uninitialized string tracing

PATCH Applied Alexey Kardashevskiy 2 participants 3 messages Apr 6, 2022 – Apr 20, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc/vof: Fix uninitialized string tracing

There are error paths which do not initialize propname but the trace_exit label prints it anyway. This initializes the problem string.

Spotted by Coverity CID 1487241.

---
 hw/ppc/vof.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/vof.c +1 -1
index 2b63a6287561..5ce3ca32c998 100644
@@ -294,7 +294,7 @@ static uint32_t vof_setprop(MachineState *ms, void *fdt, Vof *vof,
                             uint32_t nodeph, uint32_t pname,
                             uint32_t valaddr, uint32_t vallen)
 {
-    char propname[OF_PROPNAME_LEN_MAX + 1];
+    char propname[OF_PROPNAME_LEN_MAX + 1] = "";
     uint32_t ret = PROM_ERROR;
     int offset, rc;
     char trval[64] = "";
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Alexey Kardashevskiy

There are error paths which do not initialize propname but the trace_exit label prints it anyway. This initializes the problem string.

Spotted by Coverity CID 1487241.

---

Quoted 16 lines
  hw/ppc/vof.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/vof.c +1 -1
index 2b63a6287561..5ce3ca32c998 100644
@@ -294,7 +294,7 @@ static uint32_t vof_setprop(MachineState *ms, void *fdt, Vof *vof,
                              uint32_t nodeph, uint32_t pname,
                              uint32_t valaddr, uint32_t vallen)
  {
-    char propname[OF_PROPNAME_LEN_MAX + 1];
+    char propname[OF_PROPNAME_LEN_MAX + 1] = "";
      uint32_t ret = PROM_ERROR;
      int offset, rc;
      char trval[64] = "";
#2 lore raw
In reply to Alexey Kardashevskiy

Queued in gitlab.com/danielhb/qemu/tree/ppc-next. Thanks,

Daniel

Quoted 23 lines · Alexey Kardashevskiy

There are error paths which do not initialize propname but the trace_exit label prints it anyway. This initializes the problem string.

Spotted by Coverity CID 1487241.

---
  hw/ppc/vof.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/vof.c +1 -1
index 2b63a6287561..5ce3ca32c998 100644
@@ -294,7 +294,7 @@ static uint32_t vof_setprop(MachineState *ms, void *fdt, Vof *vof,
                              uint32_t nodeph, uint32_t pname,
                              uint32_t valaddr, uint32_t vallen)
  {
-    char propname[OF_PROPNAME_LEN_MAX + 1];
+    char propname[OF_PROPNAME_LEN_MAX + 1] = "";
      uint32_t ret = PROM_ERROR;
      int offset, rc;
      char trval[64] = "";