* [PATCH] ublk_drv: fix double shift bug
@ 2022-07-26 14:12 Dan Carpenter
2022-07-26 17:44 ` Christoph Hellwig
2022-07-26 18:30 ` Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2022-07-26 14:12 UTC (permalink / raw)
To: Ming Lei, Christoph Hellwig; +Cc: Jens Axboe, linux-block, kernel-janitors
The test/clear_bit() functions take a bit number, but this code is
passing as shifted value. It's the equivalent of saying BIT(BIT(0))
instead of just BIT(0).
This doesn't affect runtime because numbers are small and it's done
consistently.
Fixes: fa362045564e ("ublk: simplify ublk_ch_open and ublk_ch_release")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/block/ublk_drv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index f058f40b639c..67efad976205 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -124,8 +124,8 @@ struct ublk_device {
struct cdev cdev;
struct device cdev_dev;
-#define UB_STATE_OPEN (1 << 0)
-#define UB_STATE_USED (1 << 1)
+#define UB_STATE_OPEN 0
+#define UB_STATE_USED 1
unsigned long state;
int ub_number;
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ublk_drv: fix double shift bug
2022-07-26 14:12 [PATCH] ublk_drv: fix double shift bug Dan Carpenter
@ 2022-07-26 17:44 ` Christoph Hellwig
2022-07-26 18:30 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2022-07-26 17:44 UTC (permalink / raw)
To: Dan Carpenter
Cc: Ming Lei, Christoph Hellwig, Jens Axboe, linux-block,
kernel-janitors
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
although as-is I would not call it a bug yet as we're not going out
of unsigned long range yet.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ublk_drv: fix double shift bug
2022-07-26 14:12 [PATCH] ublk_drv: fix double shift bug Dan Carpenter
2022-07-26 17:44 ` Christoph Hellwig
@ 2022-07-26 18:30 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2022-07-26 18:30 UTC (permalink / raw)
To: ming.lei, Christoph Hellwig, dan.carpenter; +Cc: kernel-janitors, linux-block
On Tue, 26 Jul 2022 17:12:23 +0300, Dan Carpenter wrote:
> The test/clear_bit() functions take a bit number, but this code is
> passing as shifted value. It's the equivalent of saying BIT(BIT(0))
> instead of just BIT(0).
>
> This doesn't affect runtime because numbers are small and it's done
> consistently.
>
> [...]
Applied, thanks!
[1/1] ublk_drv: fix double shift bug
commit: 8d9fdb6011b4d413271eba3a62e10f89efecc419
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-26 18:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-26 14:12 [PATCH] ublk_drv: fix double shift bug Dan Carpenter
2022-07-26 17:44 ` Christoph Hellwig
2022-07-26 18:30 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox