Re: [PATCH] block/rnbd-clt: fix wrong max ID in ida_alloc_max

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Le 29/12/2022 à 12:35, Guoqing Jiang a écrit :
We need to pass 'end - 1' to ida_alloc_max after switch from
ida_simple_get to ida_alloc_max.

And 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: 24afc15dbe21 ("block/rnbd: Remove a useless mutex")
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <error27@xxxxxxxxx>
Signed-off-by: Guoqing Jiang <guoqing.jiang@xxxxxxxxx>
---

Hi,

now in -next.

It triggered my "what is in my backlog and now applied in -next".
The reason is [1].

It was Ack-b, but never applied.

So I made my mistake, but tried to fix it :).

Honor is safe, (even if my Fixes tag was wrong), LoL !

CJ


[1]: https://lore.kernel.org/all/42165d3f9dfc7abb54542d34a4e33ea8e83b101c.1648379172.git.christophe.jaillet@xxxxxxxxxx/


  drivers/block/rnbd/rnbd-clt.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/rnbd/rnbd-clt.c b/drivers/block/rnbd/rnbd-clt.c
index 78334da74d8b..8cdecec89d74 100644
--- a/drivers/block/rnbd/rnbd-clt.c
+++ b/drivers/block/rnbd/rnbd-clt.c
@@ -1440,7 +1440,7 @@ static struct rnbd_clt_dev *init_dev(struct rnbd_clt_session *sess,
  		goto out_alloc;
  	}
- ret = ida_alloc_max(&index_ida, 1 << (MINORBITS - RNBD_PART_BITS),
+	ret = ida_alloc_max(&index_ida, 1 << (MINORBITS - RNBD_PART_BITS) - 1,
  			    GFP_KERNEL);
  	if (ret < 0) {
  		pr_err("Failed to initialize device '%s' from session %s, allocating idr failed, err: %d\n",



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux