* [PATCH] scsi: iscsi: fix harmless double shift bug
@ 2022-04-21 15:03 Dan Carpenter
2022-04-21 15:38 ` Mike Christie
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Dan Carpenter @ 2022-04-21 15:03 UTC (permalink / raw)
To: Lee Duncan, Mike Christie
Cc: Chris Leech, James E.J. Bottomley, Martin K. Petersen, open-iscsi,
linux-scsi, kernel-janitors
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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
include/scsi/libiscsi.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index d0a24779c52d..c0703cd20a99 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -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
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: iscsi: fix harmless double shift bug
2022-04-21 15:03 [PATCH] scsi: iscsi: fix harmless double shift bug Dan Carpenter
@ 2022-04-21 15:38 ` Mike Christie
2022-04-21 16:14 ` Lee Duncan
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Mike Christie @ 2022-04-21 15:38 UTC (permalink / raw)
To: Dan Carpenter, Lee Duncan
Cc: Chris Leech, James E.J. Bottomley, Martin K. Petersen, open-iscsi,
linux-scsi, kernel-janitors
On 4/21/22 10:03 AM, Dan Carpenter wrote:
> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> include/scsi/libiscsi.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
> index d0a24779c52d..c0703cd20a99 100644
> --- a/include/scsi/libiscsi.h
> +++ b/include/scsi/libiscsi.h
> @@ -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
Thanks.
Reviewed-by: Mike Christie <michael.christie@oracle.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: iscsi: fix harmless double shift bug
2022-04-21 15:03 [PATCH] scsi: iscsi: fix harmless double shift bug Dan Carpenter
2022-04-21 15:38 ` Mike Christie
@ 2022-04-21 16:14 ` Lee Duncan
2022-04-22 8:20 ` Antw: [EXT] " Ulrich Windl
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Lee Duncan @ 2022-04-21 16:14 UTC (permalink / raw)
To: Dan Carpenter, Mike Christie
Cc: Chris Leech, James E.J. Bottomley, Martin K. Petersen, open-iscsi,
linux-scsi, kernel-janitors
On 4/21/22 08:03, Dan Carpenter wrote:
> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> include/scsi/libiscsi.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
> index d0a24779c52d..c0703cd20a99 100644
> --- a/include/scsi/libiscsi.h
> +++ b/include/scsi/libiscsi.h
> @@ -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
Reviewed-by: Lee Duncan <lduncan@suse.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Antw: [EXT] [PATCH] scsi: iscsi: fix harmless double shift bug
2022-04-21 15:03 [PATCH] scsi: iscsi: fix harmless double shift bug Dan Carpenter
2022-04-21 15:38 ` Mike Christie
2022-04-21 16:14 ` Lee Duncan
@ 2022-04-22 8:20 ` Ulrich Windl
2022-04-26 2:36 ` Martin K. Petersen
2022-05-03 0:51 ` Martin K. Petersen
4 siblings, 0 replies; 6+ messages in thread
From: Ulrich Windl @ 2022-04-22 8:20 UTC (permalink / raw)
To: michael.christie, Lee Duncan
Cc: open-iscsi, jejb, martin.petersen, Chris Leech, kernel-janitors,
linux-scsi
>>> Dan Carpenter <dan.carpenter@oracle.com> schrieb am 21.04.2022 um 17:03 in
Nachricht <YmFyWHf8nrrx+SHa@kili>:
> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> include/scsi/libiscsi.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
> index d0a24779c52d..c0703cd20a99 100644
> --- a/include/scsi/libiscsi.h
> +++ b/include/scsi/libiscsi.h
> @@ -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.
>
> #define ISCSI_ITT_MASK 0x1fff
> #define ISCSI_TOTAL_CMDS_MAX 4096
> --
> 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 open-iscsi+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/open-iscsi/YmFyWHf8nrrx%2BSHa%40kili.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: iscsi: fix harmless double shift bug
2022-04-21 15:03 [PATCH] scsi: iscsi: fix harmless double shift bug Dan Carpenter
` (2 preceding siblings ...)
2022-04-22 8:20 ` Antw: [EXT] " Ulrich Windl
@ 2022-04-26 2:36 ` Martin K. Petersen
2022-05-03 0:51 ` Martin K. Petersen
4 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2022-04-26 2:36 UTC (permalink / raw)
To: Dan Carpenter
Cc: Lee Duncan, Mike Christie, Chris Leech, James E.J. Bottomley,
Martin K. Petersen, open-iscsi, linux-scsi, kernel-janitors
Dan,
> 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!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: iscsi: fix harmless double shift bug
2022-04-21 15:03 [PATCH] scsi: iscsi: fix harmless double shift bug Dan Carpenter
` (3 preceding siblings ...)
2022-04-26 2:36 ` Martin K. Petersen
@ 2022-05-03 0:51 ` Martin K. Petersen
4 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2022-05-03 0:51 UTC (permalink / raw)
To: Lee Duncan, Mike Christie, Dan Carpenter
Cc: Martin K . Petersen, James E.J. Bottomley, open-iscsi,
kernel-janitors, Chris Leech, linux-scsi
On Thu, 21 Apr 2022 18:03:52 +0300, Dan Carpenter wrote:
> 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
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-05-03 23:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-21 15:03 [PATCH] scsi: iscsi: fix harmless double shift bug Dan Carpenter
2022-04-21 15:38 ` Mike Christie
2022-04-21 16:14 ` Lee Duncan
2022-04-22 8:20 ` Antw: [EXT] " Ulrich Windl
2022-04-26 2:36 ` Martin K. Petersen
2022-05-03 0:51 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox