Skip to content

Commit acf3256

Browse files
quic-jhugoJeff Hugo
authored andcommitted
bus: mhi: host: Avoid possible uninitialized fw_load_type
If mhi_fw_load_handler() bails out early because the EE is not capable of loading firmware, we may reference fw_load_type in cleanup which is uninitialized at this point. The cleanup code checks fw_load_type as a proxy for knowing if fbc_image was allocated and needs to be freed, but we can directly test for that. This avoids the possible uninitialized access and appears to be clearer code. Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/ Fixes: f88f1d0 ("bus: mhi: host: Add a policy to enable image transfer via BHIe in PBL") Signed-off-by: Jeffrey Hugo <[email protected]> Acked-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Carl Vanderlip <[email protected]> Signed-off-by: Jeff Hugo <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 27e21f2 commit acf3256

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/bus/mhi/host/boot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl)
608608
return;
609609

610610
error_ready_state:
611-
if (fw_load_type == MHI_FW_LOAD_FBC) {
611+
if (mhi_cntrl->fbc_image) {
612612
mhi_free_bhie_table(mhi_cntrl, mhi_cntrl->fbc_image);
613613
mhi_cntrl->fbc_image = NULL;
614614
}

0 commit comments

Comments
 (0)