Skip to contentSkip to conversation

qed: Fix copy of uninitialized memory

PATCH RESEND Applied Robert Foss 2 participants 2 messages Mar 7, 2017 – Mar 9, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 qed: Fix copy of uninitialized memory

In qed_ll2_start_ooo() the ll2_info variable is uninitialized and then passed to qed_ll2_acquire_connection() where it is copied into a new memory space.

This shouldn't cause any issue as long as non of the copied memory is every read.
But the potential for a bug being introduced by reading this memory is real.

Detected by CoverityScan, CID#1399632 ("Uninitialized scalar variable")

---
 drivers/net/ethernet/qlogic/qed/qed_ll2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qed/qed_ll2.c +1 -1
index 9a0b9af10a57..5fb34db377c8 100644
@@ -968,7 +968,7 @@ static int qed_ll2_start_ooo(struct qed_dev *cdev,
 {
 	struct qed_hwfn *hwfn = QED_LEADING_HWFN(cdev);
 	u8 *handle = &hwfn->pf_params.iscsi_pf_params.ll2_ooo_queue_id;
-	struct qed_ll2_conn ll2_info;
+	struct qed_ll2_conn ll2_info = { 0 };
 	int rc;
 
 	ll2_info.conn_type = QED_LL2_TYPE_ISCSI_OOO;
Signature · 1 line
2.11.0.453.g787f75f05
maintainer Applied
#1 lore raw

From: Robert Foss <[email protected]>
Date: Tue, 7 Mar 2017 11:46:25 -0500

Quoted 4 lines

In qed_ll2_start_ooo() the ll2_info variable is uninitialized and then passed to qed_ll2_acquire_connection() where it is copied into a new memory space.

Quoted 8 lines

This shouldn't cause any issue as long as non of the copied memory is every read.
But the potential for a bug being introduced by reading this memory is real.

Detected by CoverityScan, CID#1399632 ("Uninitialized scalar variable")

Applied.