[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20201112145348.51284-1-yuehaibing@huawei.com>
Date: Thu, 12 Nov 2020 22:53:48 +0800
From: YueHaibing <yuehaibing@...wei.com>
To: <josef@...icpanda.com>, <axboe@...nel.dk>
CC: <linux-block@...r.kernel.org>, <nbd@...er.debian.org>,
<linux-kernel@...r.kernel.org>, YueHaibing <yuehaibing@...wei.com>
Subject: [PATCH] nbd: Fix passing zero to 'PTR_ERR' warning
Fix smatch warning:
drivers/block/nbd.c:698 nbd_read_stat() warn: passing zero to 'ERR_PTR'
sock_xmit() never return 0, remove check 0 to fix this warning.
Signed-off-by: YueHaibing <yuehaibing@...wei.com>
---
drivers/block/nbd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index aaae9220f3a0..1620d1217581 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -691,7 +691,7 @@ static struct nbd_cmd *nbd_read_stat(struct nbd_device *nbd, int index)
reply.magic = 0;
iov_iter_kvec(&to, READ, &iov, 1, sizeof(reply));
result = sock_xmit(nbd, index, 0, &to, MSG_WAITALL, NULL);
- if (result <= 0) {
+ if (result < 0) {
if (!nbd_disconnected(config))
dev_err(disk_to_dev(nbd->disk),
"Receive control failed (result %d)\n", result);
--
2.17.1
Powered by blists - more mailing lists