Linux-Block Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] block/rnbd: Fix an IS_ERR() vs NULL check in find_or_create_sess()
@ 2020-05-19 12:03 Dan Carpenter
  2020-05-19 12:52 ` Jinpu Wang
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2020-05-19 12:03 UTC (permalink / raw)
  To: Danil Kipnis, Jack Wang
  Cc: Jens Axboe, Jason Gunthorpe, Bart Van Assche, linux-block,
	kernel-janitors

The alloc_sess() function returns error pointers, it never returns NULL.

Fixes: f7a7a5c228d4 ("block/rnbd: client: main functionality")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/block/rnbd/rnbd-clt.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/block/rnbd/rnbd-clt.c b/drivers/block/rnbd/rnbd-clt.c
index 55bff3b1be71..a033247281da 100644
--- a/drivers/block/rnbd/rnbd-clt.c
+++ b/drivers/block/rnbd/rnbd-clt.c
@@ -923,13 +923,12 @@ rnbd_clt_session *find_or_create_sess(const char *sessname, bool *first)
 	sess = __find_and_get_sess(sessname);
 	if (!sess) {
 		sess = alloc_sess(sessname);
-		if (sess) {
-			list_add(&sess->list, &sess_list);
-			*first = true;
-		} else {
+		if (IS_ERR(sess)) {
 			mutex_unlock(&sess_lock);
-			return ERR_PTR(-ENOMEM);
+			return sess;
 		}
+		list_add(&sess->list, &sess_list);
+		*first = true;
 	} else
 		*first = false;
 	mutex_unlock(&sess_lock);
-- 
2.26.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] block/rnbd: Fix an IS_ERR() vs NULL check in find_or_create_sess()
  2020-05-19 12:03 [PATCH] block/rnbd: Fix an IS_ERR() vs NULL check in find_or_create_sess() Dan Carpenter
@ 2020-05-19 12:52 ` Jinpu Wang
  2020-05-22  5:13   ` Jinpu Wang
  0 siblings, 1 reply; 6+ messages in thread
From: Jinpu Wang @ 2020-05-19 12:52 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Danil Kipnis, Jens Axboe, Jason Gunthorpe, Bart Van Assche,
	linux-block, kernel-janitors

On Tue, May 19, 2020 at 2:04 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> The alloc_sess() function returns error pointers, it never returns NULL.
>
> Fixes: f7a7a5c228d4 ("block/rnbd: client: main functionality")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thanks Dan,
Reviewed-by: Jack Wang <jinpu.wang@cloud.ionos.com>

> ---
>  drivers/block/rnbd/rnbd-clt.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/block/rnbd/rnbd-clt.c b/drivers/block/rnbd/rnbd-clt.c
> index 55bff3b1be71..a033247281da 100644
> --- a/drivers/block/rnbd/rnbd-clt.c
> +++ b/drivers/block/rnbd/rnbd-clt.c
> @@ -923,13 +923,12 @@ rnbd_clt_session *find_or_create_sess(const char *sessname, bool *first)
>         sess = __find_and_get_sess(sessname);
>         if (!sess) {
>                 sess = alloc_sess(sessname);
> -               if (sess) {
> -                       list_add(&sess->list, &sess_list);
> -                       *first = true;
> -               } else {
> +               if (IS_ERR(sess)) {
>                         mutex_unlock(&sess_lock);
> -                       return ERR_PTR(-ENOMEM);
> +                       return sess;
>                 }
> +               list_add(&sess->list, &sess_list);
> +               *first = true;
>         } else
>                 *first = false;
>         mutex_unlock(&sess_lock);
> --
> 2.26.2
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] block/rnbd: Fix an IS_ERR() vs NULL check in find_or_create_sess()
  2020-05-19 12:52 ` Jinpu Wang
@ 2020-05-22  5:13   ` Jinpu Wang
  2020-05-22 14:48     ` Jason Gunthorpe
  0 siblings, 1 reply; 6+ messages in thread
From: Jinpu Wang @ 2020-05-22  5:13 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Danil Kipnis, Jens Axboe, Bart Van Assche, linux-block,
	kernel-janitors, Dan Carpenter

On Tue, May 19, 2020 at 2:52 PM Jinpu Wang <jinpu.wang@cloud.ionos.com> wrote:
>
> On Tue, May 19, 2020 at 2:04 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > The alloc_sess() function returns error pointers, it never returns NULL.
> >
> > Fixes: f7a7a5c228d4 ("block/rnbd: client: main functionality")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Thanks Dan,
> Reviewed-by: Jack Wang <jinpu.wang@cloud.ionos.com>

Hi Jason,

Could you also queue this fix for for-next?

Thanks

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] block/rnbd: Fix an IS_ERR() vs NULL check in find_or_create_sess()
  2020-05-22  5:13   ` Jinpu Wang
@ 2020-05-22 14:48     ` Jason Gunthorpe
  2020-05-22 15:44       ` Dan Carpenter
  0 siblings, 1 reply; 6+ messages in thread
From: Jason Gunthorpe @ 2020-05-22 14:48 UTC (permalink / raw)
  To: Jinpu Wang
  Cc: Danil Kipnis, Jens Axboe, Bart Van Assche, linux-block,
	kernel-janitors, Dan Carpenter

On Fri, May 22, 2020 at 07:13:08AM +0200, Jinpu Wang wrote:
> On Tue, May 19, 2020 at 2:52 PM Jinpu Wang <jinpu.wang@cloud.ionos.com> wrote:
> >
> > On Tue, May 19, 2020 at 2:04 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > >
> > > The alloc_sess() function returns error pointers, it never returns NULL.
> > >
> > > Fixes: f7a7a5c228d4 ("block/rnbd: client: main functionality")
> > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > Thanks Dan,
> > Reviewed-by: Jack Wang <jinpu.wang@cloud.ionos.com>
> 
> Hi Jason,
> 
> Could you also queue this fix for for-next?

Uhh.. Yes OK, but if it doesn't get cc'd to linux-rdma I won't see it..

Please let me know if there are others

Thanks,
Jason

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] block/rnbd: Fix an IS_ERR() vs NULL check in find_or_create_sess()
  2020-05-22 14:48     ` Jason Gunthorpe
@ 2020-05-22 15:44       ` Dan Carpenter
  2020-05-22 16:41         ` Jason Gunthorpe
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2020-05-22 15:44 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Jinpu Wang, Danil Kipnis, Jens Axboe, Bart Van Assche,
	linux-block, kernel-janitors

On Fri, May 22, 2020 at 11:48:31AM -0300, Jason Gunthorpe wrote:
> On Fri, May 22, 2020 at 07:13:08AM +0200, Jinpu Wang wrote:
> > On Tue, May 19, 2020 at 2:52 PM Jinpu Wang <jinpu.wang@cloud.ionos.com> wrote:
> > >
> > > On Tue, May 19, 2020 at 2:04 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > > >
> > > > The alloc_sess() function returns error pointers, it never returns NULL.
> > > >
> > > > Fixes: f7a7a5c228d4 ("block/rnbd: client: main functionality")
> > > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > > Thanks Dan,
> > > Reviewed-by: Jack Wang <jinpu.wang@cloud.ionos.com>
> > 
> > Hi Jason,
> > 
> > Could you also queue this fix for for-next?
> 
> Uhh.. Yes OK, but if it doesn't get cc'd to linux-rdma I won't see it..
> 

I suspect that we should update MAINTAINERS so that
./scripts/get_maintainer.pl gives the right lists.  Proabably all
drivers/block/rnbd/ patches are supposed to go through you?

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] block/rnbd: Fix an IS_ERR() vs NULL check in find_or_create_sess()
  2020-05-22 15:44       ` Dan Carpenter
@ 2020-05-22 16:41         ` Jason Gunthorpe
  0 siblings, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2020-05-22 16:41 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jinpu Wang, Danil Kipnis, Jens Axboe, Bart Van Assche,
	linux-block, kernel-janitors

On Fri, May 22, 2020 at 06:44:03PM +0300, Dan Carpenter wrote:
> On Fri, May 22, 2020 at 11:48:31AM -0300, Jason Gunthorpe wrote:
> > On Fri, May 22, 2020 at 07:13:08AM +0200, Jinpu Wang wrote:
> > > On Tue, May 19, 2020 at 2:52 PM Jinpu Wang <jinpu.wang@cloud.ionos.com> wrote:
> > > >
> > > > On Tue, May 19, 2020 at 2:04 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > > > >
> > > > > The alloc_sess() function returns error pointers, it never returns NULL.
> > > > >
> > > > > Fixes: f7a7a5c228d4 ("block/rnbd: client: main functionality")
> > > > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > > > Thanks Dan,
> > > > Reviewed-by: Jack Wang <jinpu.wang@cloud.ionos.com>
> > > 
> > > Hi Jason,
> > > 
> > > Could you also queue this fix for for-next?
> > 
> > Uhh.. Yes OK, but if it doesn't get cc'd to linux-rdma I won't see it..
> > 
> 
> I suspect that we should update MAINTAINERS so that
> ./scripts/get_maintainer.pl gives the right lists.  Proabably all
> drivers/block/rnbd/ patches are supposed to go through you?

I think Jens will take then once everything is merged, it is just for
the next few weeks

Jason

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-19 12:03 [PATCH] block/rnbd: Fix an IS_ERR() vs NULL check in find_or_create_sess() Dan Carpenter
2020-05-19 12:52 ` Jinpu Wang
2020-05-22  5:13   ` Jinpu Wang
2020-05-22 14:48     ` Jason Gunthorpe
2020-05-22 15:44       ` Dan Carpenter
2020-05-22 16:41         ` Jason Gunthorpe

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org
	public-inbox-index linux-block

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git