diff mbox series

[qemu] ppc/vof: Fix uninitialized string tracing

Message ID 20220406045013.3610172-1-aik@ozlabs.ru
State New
Headers show
Series [qemu] ppc/vof: Fix uninitialized string tracing | expand

Commit Message

Alexey Kardashevskiy April 6, 2022, 4:50 a.m. UTC
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.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 hw/ppc/vof.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel Henrique Barboza April 6, 2022, 2:51 p.m. UTC | #1
On 4/6/22 01:50, Alexey Kardashevskiy wrote:
> 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.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

>   hw/ppc/vof.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/vof.c b/hw/ppc/vof.c
> index 2b63a6287561..5ce3ca32c998 100644
> --- a/hw/ppc/vof.c
> +++ b/hw/ppc/vof.c
> @@ -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] = "";
Daniel Henrique Barboza April 20, 2022, 7:16 p.m. UTC | #2
Queued in gitlab.com/danielhb/qemu/tree/ppc-next. Thanks,


Daniel

On 4/6/22 01:50, Alexey Kardashevskiy wrote:
> 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.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
>   hw/ppc/vof.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/vof.c b/hw/ppc/vof.c
> index 2b63a6287561..5ce3ca32c998 100644
> --- a/hw/ppc/vof.c
> +++ b/hw/ppc/vof.c
> @@ -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] = "";
diff mbox series

Patch

diff --git a/hw/ppc/vof.c b/hw/ppc/vof.c
index 2b63a6287561..5ce3ca32c998 100644
--- a/hw/ppc/vof.c
+++ b/hw/ppc/vof.c
@@ -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] = "";