[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1640226246-32691-1-git-send-email-wangqing@vivo.com>
Date: Wed, 22 Dec 2021 18:24:03 -0800
From: Qing Wang <wangqing@...o.com>
To: Jens Axboe <axboe@...nel.dk>, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Wang Qing <wangqing@...o.com>
Subject: [PATCH] block: return specific error when pointer is NULL
From: Wang Qing <wangqing@...o.com>
loop_attr_backing_file_show() better return specific error than 0
when pointer is NULL
Signed-off-by: Wang Qing <wangqing@...o.com>
---
drivers/block/loop.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index e52a8a5..860a5b6
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -667,7 +667,7 @@ static ssize_t loop_attr_backing_file_show(struct loop_device *lo, char *buf)
spin_unlock_irq(&lo->lo_lock);
if (IS_ERR_OR_NULL(p))
- ret = PTR_ERR(p);
+ ret = p ? PTR_ERR(p) : -ENOENT;
else {
ret = strlen(p);
memmove(buf, p, ret);
--
2.7.4
Powered by blists - more mailing lists