[PATCH next] io_uring/region: return negative -E2BIG in io_create_region()

Dan Carpenter posted 1 patch 1 week, 6 days ago
io_uring/memmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH next] io_uring/region: return negative -E2BIG in io_create_region()
Posted by Dan Carpenter 1 week, 6 days ago
This code accidentally returns positivie E2BIG instead of negative
-E2BIG.  The callers treat negatives and positives the same so this
doesn't affect the kernel.  The error code is returned to userspace via
the system call.

Fixes: dfbbfbf19187 ("io_uring: introduce concept of memory regions")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 io_uring/memmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/io_uring/memmap.c b/io_uring/memmap.c
index 6e6ee79ba94f..3d71756bc598 100644
--- a/io_uring/memmap.c
+++ b/io_uring/memmap.c
@@ -229,7 +229,7 @@ int io_create_region(struct io_ring_ctx *ctx, struct io_mapped_region *mr,
 	if (!reg->size || reg->mmap_offset || reg->id)
 		return -EINVAL;
 	if ((reg->size >> PAGE_SHIFT) > INT_MAX)
-		return E2BIG;
+		return -E2BIG;
 	if ((reg->user_addr | reg->size) & ~PAGE_MASK)
 		return -EINVAL;
 	if (check_add_overflow(reg->user_addr, reg->size, &end))
-- 
2.45.2
Re: [PATCH next] io_uring/region: return negative -E2BIG in io_create_region()
Posted by Jens Axboe 1 week, 6 days ago
On Wed, 20 Nov 2024 12:15:05 +0300, Dan Carpenter wrote:
> This code accidentally returns positivie E2BIG instead of negative
> -E2BIG.  The callers treat negatives and positives the same so this
> doesn't affect the kernel.  The error code is returned to userspace via
> the system call.
> 
> 

Applied, thanks!

[1/1] io_uring/region: return negative -E2BIG in io_create_region()
      commit: 2efeb13a0e2a0a188ae85ce7d838874a4c8d135d

Best regards,
-- 
Jens Axboe