[PATCH v2 02/12] block/blkio: fix error return value on getlength()
Marc-André Lureau <[email protected]> Mon, 27 Jul 2026 00:44:01 +0400
| Newsgroups | org.kernel.vger.linux-cxl,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
Negative values should be returned for errors.
Fixes: fd66dbd424 ("blkio: add libblkio block driver")
Signed-off-by: Marc-André Lureau <[email protected]>
---
block/blkio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/blkio.c b/block/blkio.c
index fb8bec27d71a..52a8be220d1c 100644
--- a/block/blkio.c
+++ b/block/blkio.c
@@ -941,7 +941,7 @@ static int64_t coroutine_fn blkio_co_getlength(BlockDriverState *bs)
ret = blkio_get_uint64(s->blkio, "capacity", &capacity);
}
if (ret < 0) {
- return -ret;
+ return ret;
}
return capacity;
--
2.55.0