Skip to contentSkip to conversation

iscsi-target: forever loop in iscsit_attach_ooo_cmdsn()

PATCH In review Dan Carpenter 2 participants 2 messages Aug 6, 2011 – Aug 8, 2011

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

PATCH 1/1 iscsi-target: forever loop in iscsit_attach_ooo_cmdsn()

I was looking through the code for something unrelated and noticed what looks like a forever loop here.

---
I am not familiar with the subsystem and haven't tested this, so please review carefully.

drivers/target/iscsi/iscsi_target_erl1.c +1 -1
index 9806507..c4c68da 100644
@@ -834,7 +834,7 @@ static int iscsit_attach_ooo_cmdsn(
 			 */
 			list_for_each_entry(ooo_tmp, &sess->sess_ooo_cmdsn_list,
 						ooo_list) {
-				while (ooo_tmp->cmdsn < ooo_cmdsn->cmdsn)
+				if (ooo_tmp->cmdsn < ooo_cmdsn->cmdsn)
 					continue;
 
 				list_add(&ooo_cmdsn->ooo_list,
#1 lore raw
Quoted 13 lines · Dan Carpenter

I was looking through the code for something unrelated and noticed what looks like a forever loop here.

---
I am not familiar with the subsystem and haven't tested this, so please review carefully.

drivers/target/iscsi/iscsi_target_erl1.c +0 -0
index 9806507..c4c68da 100644

drivers/target/iscsi/iscsi_target_erl1.c static int iscsit_attach_ooo_cmdsn(

Quoted 9 lines
drivers/target/iscsi/iscsi_target_erl1.c +1 -2
@@ -834,7 +834,7 @@ static int iscsit_attach_ooo_cmdsn(
 			 */
 			list_for_each_entry(ooo_tmp, &sess->sess_ooo_cmdsn_list,
 						ooo_list) {
-				while (ooo_tmp->cmdsn < ooo_cmdsn->cmdsn)
+				if (ooo_tmp->cmdsn < ooo_cmdsn->cmdsn)
 					continue;
 
 				list_add(&ooo_cmdsn->ooo_list,
--

Mmmm, good catch. I think this bogus while loop usage is left over from the pre sess->sess_ooo_cmd_list conversion, and it's definately not what the original logic is doing.

Committed as e7851a0e73de into lio-core-2.6.git.

Thanks Dan!

--nab