ppc/pnv: Fix uninitialized MpiplProcDumpArea struct
PATCH 1/1 ppc/pnv: Fix uninitialized MpiplProcDumpArea struct
Fix Coverity CID 1658041 by using designated initializers to prevent uninitialized memory from being written to guest.
Cc Aditya Gupta <[email protected]>
Cc Harsh Prateek Bora <[email protected]>
Reported-by Peter Maydell <[email protected]>
Suggested-by Peter Maydell <[email protected]>
Signed-off-by Shivang Upadhyay <[email protected]>"
--- hw/ppc/pnv.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
hw/ppc/pnv.c +4 -12
@@ -838,18 +838,10 @@ static void pnv_reset(MachineState *machine, ResetType type)* crash */ -MpiplProcDumpArea proc_area; - - proc_area.version =PROC_DUMP_AREA_VERSION_P9 ; - proc_area.thread_size =cpu_to_be32 (sizeof (MpiplPreservedCPUState)); - -/* These are to be allocated & assigned by the firmware */ - proc_area.alloc_addr =0 ; - proc_area.alloc_size =0 ; - -/* These get assigned after crash, when QEMU preserves the registers */ - proc_area.dest_addr =0 ; - proc_area.act_size =0 ; +MpiplProcDumpArea proc_area = { + .version =PROC_DUMP_AREA_VERSION_P9 , + .thread_size =cpu_to_be32 (sizeof (MpiplPreservedCPUState)), + };cpu_physical_memory_write (PROC_DUMP_AREA_OFF , &proc_area,sizeof (proc_area));
Signature · 1 line
2.53.0
Quoted 27 lines · Shivang Upadhyay
Fix Coverity CID 1658041 by using designated initializers to prevent uninitialized memory from being written to guest.
Cc Aditya Gupta <[email protected]>Cc Harsh Prateek Bora <[email protected]>Reported-by Peter Maydell <[email protected]>Suggested-by Peter Maydell <[email protected]>Signed-off-by Shivang Upadhyay <[email protected]>"--- hw/ppc/pnv.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)hw/ppc/pnv.c +0
-7@@ -838,18 +838,10 @@ static void pnv_reset(MachineState *machine, ResetType type)* crash */ -MpiplProcDumpArea proc_area; - - proc_area.version =PROC_DUMP_AREA_VERSION_P9 ; - proc_area.thread_size =cpu_to_be32 (sizeof (MpiplPreservedCPUState)); - -/* These are to be allocated & assigned by the firmware */ - proc_area.alloc_addr =0 ;
hw/ppc/pnv.c static void pnv_reset(MachineState *machine, ResetType type) · line 845
Quoted 10 lines
hw/ppc/pnv.c +4
-5- proc_area.alloc_size =0 ; - -/* These get assigned after crash, when QEMU preserves the registers */ - proc_area.dest_addr =0 ; - proc_area.act_size =0 ; +MpiplProcDumpArea proc_area = { + .version =PROC_DUMP_AREA_VERSION_P9 , + .thread_size =cpu_to_be32 (sizeof (MpiplPreservedCPUState)), + };
Thanks for the fix, shivang.
Reviewed-by Aditya Gupta <[email protected]>
- Aditya G
Quoted 1 line · Aditya Gupta
Reviewed-by Aditya Gupta <[email protected]>
Thanks Aditya