Skip to content

Commit 9d6033e

Browse files
Guoqing Jiangaxboe
authored andcommitted
block/rnbd-clt: fix wrong max ID in ida_alloc_max
We need to pass 'end - 1' to ida_alloc_max after switch from ida_simple_get to ida_alloc_max. Otherwise smatch warns. drivers/block/rnbd/rnbd-clt.c:1460 init_dev() error: Calling ida_alloc_max() with a 'max' argument which is a power of 2. -1 missing? Fixes: 24afc15 ("block/rnbd: Remove a useless mutex") Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Guoqing Jiang <[email protected]> Acked-by: Jack Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent e3ff888 commit 9d6033e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/block/rnbd/rnbd-clt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,7 @@ static struct rnbd_clt_dev *init_dev(struct rnbd_clt_session *sess,
14401440
goto out_alloc;
14411441
}
14421442

1443-
ret = ida_alloc_max(&index_ida, 1 << (MINORBITS - RNBD_PART_BITS),
1443+
ret = ida_alloc_max(&index_ida, (1 << (MINORBITS - RNBD_PART_BITS)) - 1,
14441444
GFP_KERNEL);
14451445
if (ret < 0) {
14461446
pr_err("Failed to initialize device '%s' from session %s, allocating idr failed, err: %d\n",

0 commit comments

Comments
 (0)