Skip to contentSkip to conversation

scsi: iscsi: fix harmless double shift bug

PATCH Applied Dan Carpenter 5 participants 6 messages Apr 21, 2022 – May 3, 2022

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

PATCH 1/1 scsi: iscsi: fix harmless double shift bug

These flags are supposed to be bit numbers. Right now they cause a double shift bug where we use BIT(BIT(2)) instead of BIT(2). Fortunately, the bit numbers are small and it's done consistently so it does not cause an issue at run time.

Fixes 5bd856256f8c ("scsi: iscsi: Merge suspend fields")
---
 include/scsi/libiscsi.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/scsi/libiscsi.h +3 -3
index d0a24779c52d..c0703cd20a99 100644
@@ -54,9 +54,9 @@ enum {
 #define ISID_SIZE			6
 
 /* Connection flags */
-#define ISCSI_CONN_FLAG_SUSPEND_TX	BIT(0)
-#define ISCSI_CONN_FLAG_SUSPEND_RX	BIT(1)
-#define ISCSI_CONN_FLAG_BOUND		BIT(2)
+#define ISCSI_CONN_FLAG_SUSPEND_TX	0
+#define ISCSI_CONN_FLAG_SUSPEND_RX	1
+#define ISCSI_CONN_FLAG_BOUND		2
 
 #define ISCSI_ITT_MASK			0x1fff
 #define ISCSI_TOTAL_CMDS_MAX		4096
Signature · 1 line
2.20.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Dan Carpenter

These flags are supposed to be bit numbers. Right now they cause a double shift bug where we use BIT(BIT(2)) instead of BIT(2). Fortunately, the bit numbers are small and it's done consistently so it does not cause an issue at run time.

Fixes 5bd856256f8c ("scsi: iscsi: Merge suspend fields")
---
 include/scsi/libiscsi.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/scsi/libiscsi.h +0 -0
index d0a24779c52d..c0703cd20a99 100644
@@ -54,9 +54,9 @@ enum {
 #define ISID_SIZE			6
 

include/scsi/libiscsi.h enum { · line 62

Quoted 10 lines
include/scsi/libiscsi.h +3 -3
 /* Connection flags */
-#define ISCSI_CONN_FLAG_SUSPEND_TX	BIT(0)
-#define ISCSI_CONN_FLAG_SUSPEND_RX	BIT(1)
-#define ISCSI_CONN_FLAG_BOUND		BIT(2)
+#define ISCSI_CONN_FLAG_SUSPEND_TX	0
+#define ISCSI_CONN_FLAG_SUSPEND_RX	1
+#define ISCSI_CONN_FLAG_BOUND		2
 
 #define ISCSI_ITT_MASK			0x1fff
 #define ISCSI_TOTAL_CMDS_MAX		4096

Thanks.

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Dan Carpenter
Quoted 18 lines · Dan Carpenter

These flags are supposed to be bit numbers. Right now they cause a double shift bug where we use BIT(BIT(2)) instead of BIT(2). Fortunately, the bit numbers are small and it's done consistently so it does not cause an issue at run time.

Fixes 5bd856256f8c ("scsi: iscsi: Merge suspend fields")
---
  include/scsi/libiscsi.h | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
include/scsi/libiscsi.h +0 -0
index d0a24779c52d..c0703cd20a99 100644
@@ -54,9 +54,9 @@ enum {
  #define ISID_SIZE			6
 

include/scsi/libiscsi.h enum { · line 62

Quoted 10 lines
include/scsi/libiscsi.h +3 -3
  /* Connection flags */
-#define ISCSI_CONN_FLAG_SUSPEND_TX	BIT(0)
-#define ISCSI_CONN_FLAG_SUSPEND_RX	BIT(1)
-#define ISCSI_CONN_FLAG_BOUND		BIT(2)
+#define ISCSI_CONN_FLAG_SUSPEND_TX	0
+#define ISCSI_CONN_FLAG_SUSPEND_RX	1
+#define ISCSI_CONN_FLAG_BOUND		2
 
  #define ISCSI_ITT_MASK			0x1fff
  #define ISCSI_TOTAL_CMDS_MAX		4096
#3 lore raw
In reply to Dan Carpenter
Quoted 1 line
Quoted 1 line
Quoted 1 line

Dan Carpenter <[email protected]> schrieb am 21.04.2022 um 17:03 in

Nachricht <YmFyWHf8nrrx+SHa@kili>:

Quoted 16 lines

These flags are supposed to be bit numbers. Right now they cause a double shift bug where we use BIT(BIT(2)) instead of BIT(2). Fortunately, the bit numbers are small and it's done consistently so it does not cause an issue at run time.

Fixes 5bd856256f8c ("scsi: iscsi: Merge suspend fields")
---
 include/scsi/libiscsi.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/scsi/libiscsi.h +0 -0
index d0a24779c52d..c0703cd20a99 100644

include/scsi/libiscsi.h enum { · line 59

Quoted 9 lines
include/scsi/libiscsi.h +3 -3
@@ -54,9 +54,9 @@ enum {
 #define ISID_SIZE			6
 
 /* Connection flags */
-#define ISCSI_CONN_FLAG_SUSPEND_TX	BIT(0)
-#define ISCSI_CONN_FLAG_SUSPEND_RX	BIT(1)
-#define ISCSI_CONN_FLAG_BOUND		BIT(2)
+#define ISCSI_CONN_FLAG_SUSPEND_TX	0
+#define ISCSI_CONN_FLAG_SUSPEND_RX	1
+#define ISCSI_CONN_FLAG_BOUND		2

Actually it's not the "flag" then, but the "flag's bit position". Personally I think applying BIT() again is the bug, not the definition.

Quoted 13 lines
include/scsi/libiscsi.h +0 -0
 #define ISCSI_ITT_MASK			0x1fff
 #define ISCSI_TOTAL_CMDS_MAX		4096
Signature · 9 lines
2.20.1

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an 
email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/open-iscsi/YmFyWHf8nrrx%2BSHa%40kili.
#4 lore raw
In reply to Dan Carpenter

Dan,

Quoted 4 lines

These flags are supposed to be bit numbers. Right now they cause a double shift bug where we use BIT(BIT(2)) instead of BIT(2). Fortunately, the bit numbers are small and it's done consistently so it does not cause an issue at run time.

Applied to 5.19/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#5 lore raw
In reply to Dan Carpenter
Quoted 6 lines · Dan Carpenter

These flags are supposed to be bit numbers. Right now they cause a double shift bug where we use BIT(BIT(2)) instead of BIT(2). Fortunately, the bit numbers are small and it's done consistently so it does not cause an issue at run time.

Applied to 5.19/scsi-queue, thanks!

[1/1] scsi: iscsi: fix harmless double shift bug

      https://git.kernel.org/mkp/scsi/c/565138ac5f8a
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering