Skip to content

Commit a61b033

Browse files
committed
qed: fix possible uninit pointer read in qed_mcp_nvm_info_populate()
JIRA: https://issues.redhat.com/browse/RHEL-72637 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. Closes: https://scan5.scan.coverity.com/#/project-view/63204/10063?selectedIssue=1636666 Suggested-by: Simon Horman <horms@kernel.org> Signed-off-by: Gianfranco Trad <gianf.trad@gmail.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20241215011733.351325-2-gianf.trad@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> (cherry picked from commit 7ed2d91) Signed-off-by: John Meneghini <jmeneghi@redhat.com>
1 parent 60f24a1 commit a61b033

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/ethernet/qlogic/qed/qed_mcp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3358,6 +3358,7 @@ int qed_mcp_nvm_info_populate(struct qed_hwfn *p_hwfn)
33583358
p_ptt, &nvm_info.num_images);
33593359
if (rc == -EOPNOTSUPP) {
33603360
DP_INFO(p_hwfn, "DRV_MSG_CODE_BIST_TEST is not supported\n");
3361+
nvm_info.num_images = 0;
33613362
goto out;
33623363
} else if (rc || !nvm_info.num_images) {
33633364
DP_ERR(p_hwfn, "Failed getting number of images\n");

0 commit comments

Comments
 (0)