qed: fix possible uninit pointer read in qed_mcp_nvm_info_populate()
Subsystems (3)
PATCH v2 1/1 qed: fix possible uninit pointer read in qed_mcp_nvm_info_populate()
Coverity reports an uninit pointer read in qed_mcp_nvm_info_populate(). If EOPNOTSUPP is returned from qed_mcp_bist_nvm_get_num_images() ensure nvm_info.num_images is set to 0 to avoid possible uninit assignment to p_hwfn->nvm_info.image_att later on in out label.
---
Notes:
- Changes in v2: set nvm_info.num_images to 0 before goto out.
- Link to v1: https://lore.kernel.org/all/[email protected]/
drivers/net/ethernet/qlogic/qed/qed_mcp.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/qlogic/qed/qed_mcp.c +1 -0
@@ -3358,6 +3358,7 @@ int qed_mcp_nvm_info_populate(struct qed_hwfn *p_hwfn) p_ptt, &nvm_info.num_images);if (rc == -EOPNOTSUPP ) {DP_INFO (p_hwfn,"DRV_MSG_CODE_BIST_TEST is not supported\n" ); + nvm_info.num_images =0 ; goto out; }else if (rc || !nvm_info.num_images) {DP_ERR (p_hwfn,"Failed getting number of images\n" );
Signature · 1 line
2.43.0
Quoted 5 lines · Gianfranco Trad
Coverity reports an uninit pointer read in
qed_mcp_nvm_info_populate(). If EOPNOTSUPP is returned fromqed_mcp_bist_nvm_get_num_images()ensure nvm_info.num_images is set to 0 to avoid possible uninit assignment top_hwfn->nvm_info.image_attlater on in out label.
Quoted 7 lines
Suggested-by Simon Horman <[email protected]>Signed-off-by Gianfranco Trad <[email protected]>---
Notes:
- Changes in v2: set nvm_info.num_images to 0 before goto out.
- Link to v1: https://lore.kernel.org/all/[email protected]/
Thanks for the update.
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 10 lines · On Sun, 15 Dec 2024 02:17:34 +0100 you wrote:
Coverity reports an uninit pointer read in
qed_mcp_nvm_info_populate(). If EOPNOTSUPP is returned fromqed_mcp_bist_nvm_get_num_images()ensure nvm_info.num_images is set to 0 to avoid possible uninit assignment top_hwfn->nvm_info.image_attlater on in out label.Suggested-by Simon Horman <[email protected]>Signed-off-by Gianfranco Trad <[email protected]>[...]
Here is the summary with links:
- [v2] qed: fix possible uninit pointer read in qed_mcp_nvm_info_populate()
https://git.kernel.org/netdev/net/c/7ed2d9158877
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html