lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1527767595-76082-1-git-send-email-weiyongjun1@huawei.com>
Date:   Thu, 31 May 2018 11:53:15 +0000
From:   Wei Yongjun <weiyongjun1@...wei.com>
To:     Alasdair Kergon <agk@...hat.com>,
        Mike Snitzer <snitzer@...hat.com>,
        Mikulas Patocka <mpatocka@...hat.com>
CC:     Wei Yongjun <weiyongjun1@...wei.com>, <dm-devel@...hat.com>,
        <linux-kernel@...r.kernel.org>, <kernel-janitors@...r.kernel.org>
Subject: [PATCH -next] dm writecache: fix return value check in writecache_ctr()

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@...wei.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;
 		}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ