Linux block layer
 help / color / mirror / Atom feed
From: Guoqing Jiang <guoqing.jiang@linux.dev>
To: axboe@kernel.dk
Cc: linux-block@vger.kernel.org, haris.iqbal@ionos.com,
	christophe.jaillet@wanadoo.fr, jinpu.wang@ionos.com
Subject: Re: [PATCH V2] block/rnbd-clt: fix wrong max ID in ida_alloc_max
Date: Tue, 17 Jan 2023 21:30:43 +0800	[thread overview]
Message-ID: <665d3904-1d46-cc17-fbc2-bc5ab269423f@linux.dev> (raw)
In-Reply-To: <20221230010926.32243-1-guoqing.jiang@linux.dev>

Hi Jens,

Could you pls merge this one?

Thanks,
Guoqing

On 12/30/22 09:09, Guoqing Jiang wrote:
> 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: 24afc15dbe21 ("block/rnbd: Remove a useless mutex")
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <error27@gmail.com>
> Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
> ---
> V2 changes:
> 1. add parentheses around ‘-’ per lkp
>
>   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..5eb8c7855970 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",


  parent reply	other threads:[~2023-01-17 13:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-30  1:09 [PATCH V2] block/rnbd-clt: fix wrong max ID in ida_alloc_max Guoqing Jiang
2023-01-02 11:46 ` Jinpu Wang
2023-01-17 13:30 ` Guoqing Jiang [this message]
2023-01-17 15:33 ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=665d3904-1d46-cc17-fbc2-bc5ab269423f@linux.dev \
    --to=guoqing.jiang@linux.dev \
    --cc=axboe@kernel.dk \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=haris.iqbal@ionos.com \
    --cc=jinpu.wang@ionos.com \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox