projects/linux·commit 8d9fdb60

ublk_drv: fix double shift bug

8d9fdb60 · Dan Carpenter <[email protected]> · 2022-07-26 17:12:23 +03:00

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 <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Link: https://lore.kernel.org/r/Yt/2R/+MJf/MSoyl@kili
Signed-off-by: Jens Axboe <[email protected]>
Commit
8d9fdb6011b4d413271eba3a62e10f89efecc419
Parents
6d8c5afc

Changes

1 files changed · +2 −2

FileStatusAddDelContent
drivers/block/ublk_drv.cmodified+2−2View file

drivers/block/ublk_drv.c

View file
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 255b2de..3f19069 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -127,8 +127,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;