EDAC/bluefield: dont use bluefield_edac_readl result on error
Subsystems (2)
David Thompson
maintainerPATCH 1/1 EDAC/bluefield: dont use bluefield_edac_readl result on error
The "bluefield_edac_readl()" routine returns an uninitialized result during error paths. In those cases the calling routine should not use the uninitialized result. The driver should simply log the error, and then return early.
--- drivers/edac/bluefield_edac.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/edac/bluefield_edac.c +15 -5
@@ -199,8 +199,10 @@ static void bluefield_gather_report_ecc(struct mem_ctl_info *mci,* error without the detailed information. */ err =bluefield_edac_readl (priv,MLXBF_SYNDROM , &dram_syndrom); -if (err) +if (err) {dev_err (priv->dev,"DRAM syndrom read failed.\n" ); +return ; + } serr =FIELD_GET (MLXBF_SYNDROM__SERR , dram_syndrom); derr =FIELD_GET (MLXBF_SYNDROM__DERR , dram_syndrom);
@@ -213,20 +215,26 @@ static void bluefield_gather_report_ecc(struct mem_ctl_info *mci, } err =bluefield_edac_readl (priv,MLXBF_ADD_INFO , &dram_additional_info); -if (err) +if (err) {dev_err (priv->dev,"DRAM additional info read failed.\n" ); +return ; + } err_prank =FIELD_GET (MLXBF_ADD_INFO__ERR_PRANK , dram_additional_info); ecc_dimm = (err_prank >=2 && priv->dimm_ranks[0 ] <=2 ) ?1 :0 ; err =bluefield_edac_readl (priv,MLXBF_ERR_ADDR_0 , &edea0); -if (err) +if (err) {dev_err (priv->dev,"Error addr 0 read failed.\n" ); +return ; + } err =bluefield_edac_readl (priv,MLXBF_ERR_ADDR_1 , &edea1); -if (err) +if (err) {dev_err (priv->dev,"Error addr 1 read failed.\n" ); +return ; + } ecc_dimm_addr = ((u64 )edea1 <<32 ) | edea0;
@@ -250,8 +258,10 @@ static void bluefield_edac_check(struct mem_ctl_info *mci)return ; err =bluefield_edac_readl (priv,MLXBF_ECC_CNT , &ecc_count); -if (err) +if (err) {dev_err (priv->dev,"ECC count read failed.\n" ); +return ; + } single_error_count =FIELD_GET (MLXBF_ECC_CNT__SERR_CNT , ecc_count); double_error_count =FIELD_GET (MLXBF_ECC_CNT__DERR_CNT , ecc_count);
Signature · 1 line
2.43.2
David Thompson
maintainerQuoted 14 lines
-----Original Message-----
From: David Thompson <[email protected]>
Sent: Tuesday, March 18, 2025 5:48 PM
To: Shravan Ramani <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; David Thompson <[email protected]>
Subject: [PATCH] EDAC/bluefield: dont usebluefield_edac_readlresult on errorThe "
bluefield_edac_readl()" routine returns an uninitialized result during error paths. In those cases the calling routine should not use the uninitialized result. The driver should simply log the error, and then return early.
Quoted 8 lines
Fixes e41967575474 ("EDAC/bluefield: Use Arm SMC for EMI access onBlueField-2")
Signed-off-by David Thompson <[email protected]>Reviewed-by Shravan Kumar Ramani <[email protected]>--- drivers/edac/bluefield_edac.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
Refreshing this review...
Does anyone have feedback on this EDAC driver patch?
Thanks, Dave
Borislav Petkov
maintainerQuoted 23 lines · David Thompson
Quoted 14 lines
-----Original Message-----
From: David Thompson <[email protected]>
Sent: Tuesday, March 18, 2025 5:48 PM
To: Shravan Ramani <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; David Thompson <[email protected]>
Subject: [PATCH] EDAC/bluefield: dont usebluefield_edac_readlresult on errorThe "
bluefield_edac_readl()" routine returns an uninitialized result during error paths. In those cases the calling routine should not use the uninitialized result. The driver should simply log the error, and then return early.Quoted 8 lines
Fixes e41967575474 ("EDAC/bluefield: Use Arm SMC for EMI access onBlueField-2")
Signed-off-by David Thompson <[email protected]>Reviewed-by Shravan Kumar Ramani <[email protected]>--- drivers/edac/bluefield_edac.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
Quoted 3 lines
Refreshing this review...
Does anyone have feedback on this EDAC driver patch?
Looks like it fell through the cracks... :-\
Queued now.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette