[PATCH net] qed/qed_sriov: propagate errors from qed_init_run in enable_vf_access

Daniil Tatianin posted 1 patch 2 years, 8 months ago
drivers/net/ethernet/qlogic/qed/qed_sriov.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH net] qed/qed_sriov: propagate errors from qed_init_run in enable_vf_access
Posted by Daniil Tatianin 2 years, 8 months ago
The return value was silently ignored, and not propagated to the caller.

Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.

Fixes: 1408cc1fa48c ("qed: Introduce VFs")
Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
---
I'm not familiar enough with the code to know if there's anything we
have to undo here in case qed_init_run returns an error. Any additional
comments are appreciated.
---
 drivers/net/ethernet/qlogic/qed/qed_sriov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.c b/drivers/net/ethernet/qlogic/qed/qed_sriov.c
index fa167b1aa019..5244d7208eb4 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c
@@ -814,7 +814,7 @@ static int qed_iov_enable_vf_access(struct qed_hwfn *p_hwfn,
 	SET_FIELD(igu_vf_conf, IGU_VF_CONF_PARENT, p_hwfn->rel_pf_id);
 	STORE_RT_REG(p_hwfn, IGU_REG_VF_CONFIGURATION_RT_OFFSET, igu_vf_conf);
 
-	qed_init_run(p_hwfn, p_ptt, PHASE_VF, vf->abs_vf_id,
+	rc = qed_init_run(p_hwfn, p_ptt, PHASE_VF, vf->abs_vf_id,
 		     p_hwfn->hw_info.hw_mode);
 
 	/* unpretend */
-- 
2.25.1
Re: [PATCH net] qed/qed_sriov: propagate errors from qed_init_run in enable_vf_access
Posted by Jakub Kicinski 2 years, 8 months ago
On Thu, 20 Apr 2023 11:20:16 +0300 Daniil Tatianin wrote:
> The return value was silently ignored, and not propagated to the caller.
> 
> Found by Linux Verification Center (linuxtesting.org) with the SVACE
> static analysis tool.
> 
> Fixes: 1408cc1fa48c ("qed: Introduce VFs")
> Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
> ---
> I'm not familiar enough with the code to know if there's anything we
> have to undo here in case qed_init_run returns an error. Any additional
> comments are appreciated.

This patch does not inspire confidence. This is a pretty old driver, 
you need to provide some reasoning why checking the return value is
important, and correct.
-- 
pw-bot: cr