All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] dm writecache: fix return value check in writecache_ctr()
@ 2018-05-31 11:53 ` Wei Yongjun
  0 siblings, 0 replies; 6+ messages in thread
From: Wei Yongjun @ 2018-05-31 11:53 UTC (permalink / raw)
  To: Alasdair Kergon, Mike Snitzer, Mikulas Patocka
  Cc: Wei Yongjun, dm-devel, linux-kernel, kernel-janitors

Function dm_io_client_create() and dm_kcopyd_client_create() return
ERR_PTR() not NULL in case of error. The NULL test in the return value
check should be replaced with IS_ERR()

Fixes: 2105231db61b ("dm: add writecache target")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/md/dm-writecache.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
index 844c4fb..0b2b436 100644
--- a/drivers/md/dm-writecache.c
+++ b/drivers/md/dm-writecache.c
@@ -1872,9 +1872,10 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
 	}
 
 	wc->dm_io = dm_io_client_create();
-	if (!wc->dm_io) {
-		r = -ENOMEM;
+	if (IS_ERR(wc->dm_io)) {
+		r = PTR_ERR(wc->dm_io);
 		ti->error = "Unable to allocate dm-io client";
+		wc->dm_io = NULL;
 		goto bad;
 	}
 
@@ -2096,9 +2097,10 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
 		}
 
 		wc->dm_kcopyd = dm_kcopyd_client_create(&dm_kcopyd_throttle);
-		if (!wc->dm_kcopyd) {
-			r = -ENOMEM;
+		if (IS_ERR(wc->dm_kcopyd)) {
+			r = PTR_ERR(wc->dm_kcopyd);
 			ti->error = "Unable to allocate dm-kcopyd client";
+			wc->dm_kcopyd = NULL;
 			goto bad;
 		}

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

* [PATCH -next] dm writecache: fix return value check in writecache_ctr()
@ 2018-05-31 11:53 ` Wei Yongjun
  0 siblings, 0 replies; 6+ messages in thread
From: Wei Yongjun @ 2018-05-31 11:53 UTC (permalink / raw)
  To: Alasdair Kergon, Mike Snitzer, Mikulas Patocka
  Cc: Wei Yongjun, dm-devel, linux-kernel, kernel-janitors

Function dm_io_client_create() and dm_kcopyd_client_create() return
ERR_PTR() not NULL in case of error. The NULL test in the return value
check should be replaced with IS_ERR()

Fixes: 2105231db61b ("dm: add writecache target")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/md/dm-writecache.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
index 844c4fb..0b2b436 100644
--- a/drivers/md/dm-writecache.c
+++ b/drivers/md/dm-writecache.c
@@ -1872,9 +1872,10 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
 	}
 
 	wc->dm_io = dm_io_client_create();
-	if (!wc->dm_io) {
-		r = -ENOMEM;
+	if (IS_ERR(wc->dm_io)) {
+		r = PTR_ERR(wc->dm_io);
 		ti->error = "Unable to allocate dm-io client";
+		wc->dm_io = NULL;
 		goto bad;
 	}
 
@@ -2096,9 +2097,10 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
 		}
 
 		wc->dm_kcopyd = dm_kcopyd_client_create(&dm_kcopyd_throttle);
-		if (!wc->dm_kcopyd) {
-			r = -ENOMEM;
+		if (IS_ERR(wc->dm_kcopyd)) {
+			r = PTR_ERR(wc->dm_kcopyd);
 			ti->error = "Unable to allocate dm-kcopyd client";
+			wc->dm_kcopyd = NULL;
 			goto bad;
 		}

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

* Re: [PATCH -next] dm writecache: fix return value check in writecache_ctr()
  2018-05-31 11:53 ` Wei Yongjun
@ 2018-05-31 16:02   ` Mike Snitzer
  -1 siblings, 0 replies; 6+ messages in thread
From: Mike Snitzer @ 2018-05-31 16:02 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Alasdair Kergon, Mikulas Patocka, dm-devel, linux-kernel,
	kernel-janitors

On Thu, May 31 2018 at  7:53am -0400,
Wei Yongjun <weiyongjun1@huawei.com> wrote:

> Function dm_io_client_create() and dm_kcopyd_client_create() return
> ERR_PTR() not NULL in case of error. The NULL test in the return value
> check should be replaced with IS_ERR()
> 
> Fixes: 2105231db61b ("dm: add writecache target")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/md/dm-writecache.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
> index 844c4fb..0b2b436 100644
> --- a/drivers/md/dm-writecache.c
> +++ b/drivers/md/dm-writecache.c
> @@ -1872,9 +1872,10 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
>  	}
>  
>  	wc->dm_io = dm_io_client_create();
> -	if (!wc->dm_io) {
> -		r = -ENOMEM;
> +	if (IS_ERR(wc->dm_io)) {
> +		r = PTR_ERR(wc->dm_io);
>  		ti->error = "Unable to allocate dm-io client";
> +		wc->dm_io = NULL;
>  		goto bad;
>  	}
>  
> @@ -2096,9 +2097,10 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
>  		}
>  
>  		wc->dm_kcopyd = dm_kcopyd_client_create(&dm_kcopyd_throttle);
> -		if (!wc->dm_kcopyd) {
> -			r = -ENOMEM;
> +		if (IS_ERR(wc->dm_kcopyd)) {
> +			r = PTR_ERR(wc->dm_kcopyd);
>  			ti->error = "Unable to allocate dm-kcopyd client";
> +			wc->dm_kcopyd = NULL;
>  			goto bad;
>  		}
> 


Yes, I forgot to pull this in.. it got lost in the shuffle.  Mikulas had
provided this same change (folded into a larger patch) yesterday, see:
https://patchwork.kernel.org/patch/10439345/

I'll get this folded in ASAP.

Thanks,
Mike

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

* Re: [PATCH -next] dm writecache: fix return value check in writecache_ctr()
@ 2018-05-31 16:02   ` Mike Snitzer
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Snitzer @ 2018-05-31 16:02 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Alasdair Kergon, Mikulas Patocka, dm-devel, linux-kernel,
	kernel-janitors

On Thu, May 31 2018 at  7:53am -0400,
Wei Yongjun <weiyongjun1@huawei.com> wrote:

> Function dm_io_client_create() and dm_kcopyd_client_create() return
> ERR_PTR() not NULL in case of error. The NULL test in the return value
> check should be replaced with IS_ERR()
> 
> Fixes: 2105231db61b ("dm: add writecache target")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/md/dm-writecache.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
> index 844c4fb..0b2b436 100644
> --- a/drivers/md/dm-writecache.c
> +++ b/drivers/md/dm-writecache.c
> @@ -1872,9 +1872,10 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
>  	}
>  
>  	wc->dm_io = dm_io_client_create();
> -	if (!wc->dm_io) {
> -		r = -ENOMEM;
> +	if (IS_ERR(wc->dm_io)) {
> +		r = PTR_ERR(wc->dm_io);
>  		ti->error = "Unable to allocate dm-io client";
> +		wc->dm_io = NULL;
>  		goto bad;
>  	}
>  
> @@ -2096,9 +2097,10 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
>  		}
>  
>  		wc->dm_kcopyd = dm_kcopyd_client_create(&dm_kcopyd_throttle);
> -		if (!wc->dm_kcopyd) {
> -			r = -ENOMEM;
> +		if (IS_ERR(wc->dm_kcopyd)) {
> +			r = PTR_ERR(wc->dm_kcopyd);
>  			ti->error = "Unable to allocate dm-kcopyd client";
> +			wc->dm_kcopyd = NULL;
>  			goto bad;
>  		}
> 


Yes, I forgot to pull this in.. it got lost in the shuffle.  Mikulas had
provided this same change (folded into a larger patch) yesterday, see:
https://patchwork.kernel.org/patch/10439345/

I'll get this folded in ASAP.

Thanks,
Mike

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

* Re: [PATCH -next] dm writecache: fix return value check in writecache_ctr()
  2018-05-31 16:02   ` Mike Snitzer
@ 2018-05-31 16:07     ` Mike Snitzer
  -1 siblings, 0 replies; 6+ messages in thread
From: Mike Snitzer @ 2018-05-31 16:07 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Alasdair Kergon, Mikulas Patocka, dm-devel, linux-kernel,
	kernel-janitors

On Thu, May 31 2018 at 12:02pm -0400,
Mike Snitzer <snitzer@redhat.com> wrote:

> On Thu, May 31 2018 at  7:53am -0400,
> Wei Yongjun <weiyongjun1@huawei.com> wrote:
> 
> > Function dm_io_client_create() and dm_kcopyd_client_create() return
> > ERR_PTR() not NULL in case of error. The NULL test in the return value
> > check should be replaced with IS_ERR()
> > 
> > Fixes: 2105231db61b ("dm: add writecache target")
> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> > ---
> >  drivers/md/dm-writecache.c | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
> > index 844c4fb..0b2b436 100644
> > --- a/drivers/md/dm-writecache.c
> > +++ b/drivers/md/dm-writecache.c
> > @@ -1872,9 +1872,10 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
> >  	}
> >  
> >  	wc->dm_io = dm_io_client_create();
> > -	if (!wc->dm_io) {
> > -		r = -ENOMEM;
> > +	if (IS_ERR(wc->dm_io)) {
> > +		r = PTR_ERR(wc->dm_io);
> >  		ti->error = "Unable to allocate dm-io client";
> > +		wc->dm_io = NULL;
> >  		goto bad;
> >  	}
> >  
> > @@ -2096,9 +2097,10 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
> >  		}
> >  
> >  		wc->dm_kcopyd = dm_kcopyd_client_create(&dm_kcopyd_throttle);
> > -		if (!wc->dm_kcopyd) {
> > -			r = -ENOMEM;
> > +		if (IS_ERR(wc->dm_kcopyd)) {
> > +			r = PTR_ERR(wc->dm_kcopyd);
> >  			ti->error = "Unable to allocate dm-kcopyd client";
> > +			wc->dm_kcopyd = NULL;
> >  			goto bad;
> >  		}
> > 
> 
> 
> Yes, I forgot to pull this in.. it got lost in the shuffle.  Mikulas had
> provided this same change (folded into a larger patch) yesterday, see:
> https://patchwork.kernel.org/patch/10439345/
> 
> I'll get this folded in ASAP.

Turns out I already did fold it in.  My push to linux-next just missed
today's tree.

So already taken care of.

Thanks for sending the patch though.

Mike

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

* Re: [PATCH -next] dm writecache: fix return value check in writecache_ctr()
@ 2018-05-31 16:07     ` Mike Snitzer
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Snitzer @ 2018-05-31 16:07 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Alasdair Kergon, Mikulas Patocka, dm-devel, linux-kernel,
	kernel-janitors

On Thu, May 31 2018 at 12:02pm -0400,
Mike Snitzer <snitzer@redhat.com> wrote:

> On Thu, May 31 2018 at  7:53am -0400,
> Wei Yongjun <weiyongjun1@huawei.com> wrote:
> 
> > Function dm_io_client_create() and dm_kcopyd_client_create() return
> > ERR_PTR() not NULL in case of error. The NULL test in the return value
> > check should be replaced with IS_ERR()
> > 
> > Fixes: 2105231db61b ("dm: add writecache target")
> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> > ---
> >  drivers/md/dm-writecache.c | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
> > index 844c4fb..0b2b436 100644
> > --- a/drivers/md/dm-writecache.c
> > +++ b/drivers/md/dm-writecache.c
> > @@ -1872,9 +1872,10 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
> >  	}
> >  
> >  	wc->dm_io = dm_io_client_create();
> > -	if (!wc->dm_io) {
> > -		r = -ENOMEM;
> > +	if (IS_ERR(wc->dm_io)) {
> > +		r = PTR_ERR(wc->dm_io);
> >  		ti->error = "Unable to allocate dm-io client";
> > +		wc->dm_io = NULL;
> >  		goto bad;
> >  	}
> >  
> > @@ -2096,9 +2097,10 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
> >  		}
> >  
> >  		wc->dm_kcopyd = dm_kcopyd_client_create(&dm_kcopyd_throttle);
> > -		if (!wc->dm_kcopyd) {
> > -			r = -ENOMEM;
> > +		if (IS_ERR(wc->dm_kcopyd)) {
> > +			r = PTR_ERR(wc->dm_kcopyd);
> >  			ti->error = "Unable to allocate dm-kcopyd client";
> > +			wc->dm_kcopyd = NULL;
> >  			goto bad;
> >  		}
> > 
> 
> 
> Yes, I forgot to pull this in.. it got lost in the shuffle.  Mikulas had
> provided this same change (folded into a larger patch) yesterday, see:
> https://patchwork.kernel.org/patch/10439345/
> 
> I'll get this folded in ASAP.

Turns out I already did fold it in.  My push to linux-next just missed
today's tree.

So already taken care of.

Thanks for sending the patch though.

Mike

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

end of thread, other threads:[~2018-05-31 16:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-31 11:53 [PATCH -next] dm writecache: fix return value check in writecache_ctr() Wei Yongjun
2018-05-31 11:53 ` Wei Yongjun
2018-05-31 16:02 ` Mike Snitzer
2018-05-31 16:02   ` Mike Snitzer
2018-05-31 16:07   ` Mike Snitzer
2018-05-31 16:07     ` Mike Snitzer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.