Fix coverity issues for AST2700
v3 cover Fix coverity issues for AST2700
change from v1:
aspeed/soc: coverity defect: DIVIDE_BY_ZERO aspeed/sdmc: coverity defect: Control flow issues (DEADCODE)
change from v2:
add more commit log from reviewer suggestion, Cédric.
change from v3:
replace qemu_log_mask with assert dram size 0.
Jamin Lin (2):
aspeed/soc: Fix possible divide by zero
aspeed/sdmc: Remove extra R_MAIN_STATUS case
hw/arm/aspeed_ast27x0.c | 2 ++ hw/misc/aspeed_sdmc.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-)
Signature · 1 line
2.25.1
PATCH v3 1/2 aspeed/soc: Fix possible divide by zero
Coverity reports a possible DIVIDE_BY_ZERO issue regarding the "ram_size" object property. This can not happen because RAM has predefined valid sizes per SoC. Nevertheless, add a test to close the issue.
--- hw/arm/aspeed_ast27x0.c | 2 ++ 1 file changed, 2 insertions(+)
hw/arm/aspeed_ast27x0.c +2 -0
@@ -211,6 +211,8 @@ static void aspeed_ram_capacity_write(void *opaque, hwaddr addr, uint64_t data, ram_size =object_property_get_uint (OBJECT (&s->sdmc),"ram-size" , &error_abort); +assert (ram_size >0 ); +/* * Emulate ddr capacity hardware behavior. * If writes the data to the address which is beyond the ram size,
Signature · 1 line
2.25.1
PATCH v3 2/2 aspeed/sdmc: Remove extra R_MAIN_STATUS case
In reply to Jamin Lin viaCoverity reports that the newly added 'case R_MAIN_STATUS' is DEADCODE because it can not be reached. This is because R_MAIN_STATUS is handled before in the "Unprotected registers" switch statement. Remove it.
--- hw/misc/aspeed_sdmc.c | 1 - 1 file changed, 1 deletion(-)
hw/misc/aspeed_sdmc.c +0 -1
@@ -589,7 +589,6 @@ static void aspeed_2700_sdmc_write(AspeedSDMCState *s, uint32_t reg,case R_INT_STATUS :case R_INT_CLEAR :case R_INT_MASK : -case R_MAIN_STATUS :case R_ERR_STATUS :case R_ECC_FAIL_STATUS :case R_ECC_FAIL_ADDR :
Signature · 1 line
2.25.1
Hello Jamin
Quoted 10 lines · Jamin Lin
change from v1:
aspeed/soc: coverity defect:DIVIDE_BY_ZEROaspeed/sdmc: coverity defect: Control flow issues (DEADCODE)change from v2:
add more commit log from reviewer suggestion, Cédric.change from v3:
replaceqemu_log_maskwith assert dram size 0.
Quoted 8 lines
Jamin Lin (2):
aspeed/soc: Fix possible divide by zero
aspeed/sdmc: Remove extraR_MAIN_STATUScasehw/arm/aspeed_ast27x0.c | 2 ++ hw/misc/aspeed_sdmc.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-)
LGTM.
Could you please review :
https://lore.kernel.org/qemu-devel/[email protected]/T/#u
Thanks,
C.
Hi Cedric,
Quoted 28 lines
-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Tuesday, June 25, 2024 3:22 PM
To: Jamin Lin <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[email protected]>; Troy Lee <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Subject: Re: [PATCH v3 0/2] Fix coverity issues for AST2700Hello Jamin
Quoted 14 lines · Jamin Lin
change from v1:
aspeed/soc: coverity defect:DIVIDE_BY_ZEROaspeed/sdmc: coverity defect: Control flow issues (DEADCODE)change from v2:
add more commit log from reviewer suggestion, Cédric.change from v3:
replaceqemu_log_maskwith assert dram size 0.Jamin Lin (2):
aspeed/soc: Fix possible divide by zero
aspeed/sdmc: Remove extraR_MAIN_STATUScase
Quoted 9 lines
Quoted 4 lines
hw/arm/aspeed_ast27x0.c | 2 ++ hw/misc/aspeed_sdmc.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-)LGTM.
Could you please review :
Done.
Thanks-Jamin
Quoted 7 lines
https://lore.kernel.org/qemu-devel/[email protected]
m/T/#uThanks,
C.
Cédric Le Goater
AppliedQuoted 10 lines · Jamin Lin
change from v1:
aspeed/soc: coverity defect:DIVIDE_BY_ZEROaspeed/sdmc: coverity defect: Control flow issues (DEADCODE)change from v2:
add more commit log from reviewer suggestion, Cédric.change from v3:
replaceqemu_log_maskwith assert dram size 0.
Quoted 8 lines
Jamin Lin (2):
aspeed/soc: Fix possible divide by zero
aspeed/sdmc: Remove extraR_MAIN_STATUScasehw/arm/aspeed_ast27x0.c | 2 ++ hw/misc/aspeed_sdmc.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-)
Applied to aspeed-next.
Thanks,
C.