linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nbd: Fix passing zero to 'PTR_ERR' warning
@ 2020-11-12 14:53 YueHaibing
  0 siblings, 0 replies; only message in thread
From: YueHaibing @ 2020-11-12 14:53 UTC (permalink / raw)
  To: josef, axboe; +Cc: linux-block, nbd, linux-kernel, YueHaibing

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@huawei.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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-12 14:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-12 14:53 [PATCH] nbd: Fix passing zero to 'PTR_ERR' warning YueHaibing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).