[patch] iscsi-target: forever loop in iscsit_attach_ooo_cmdsn()

Subsystems: scsi target subsystem, the rest

STALE5556d

2 messages, 2 authors, 2011-08-08 · open the first message on its own page

[patch] iscsi-target: forever loop in iscsit_attach_ooo_cmdsn()

From: Dan Carpenter <hidden>
Date: 2011-08-06 14:32:06

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

Signed-off-by: Dan Carpenter <redacted>
---
I am not familiar with the subsystem and haven't tested this, so
please review carefully.
diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c
index 9806507..c4c68da 100644
--- a/drivers/target/iscsi/iscsi_target_erl1.c
+++ b/drivers/target/iscsi/iscsi_target_erl1.c
@@ -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,

Re: [patch] iscsi-target: forever loop in iscsit_attach_ooo_cmdsn()

From: Nicholas A. Bellinger <hidden>
Date: 2011-08-08 21:17:11

On Sat, 2011-08-06 at 07:32 -0700, Dan Carpenter wrote:
quoted hunk
I was looking through the code for something unrelated and noticed
what looks like a forever loop here.

Signed-off-by: Dan Carpenter <redacted>
---
I am not familiar with the subsystem and haven't tested this, so
please review carefully.
diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c
index 9806507..c4c68da 100644
--- a/drivers/target/iscsi/iscsi_target_erl1.c
+++ b/drivers/target/iscsi/iscsi_target_erl1.c
@@ -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


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help