Re: [PATCH] iouring:added boundary value check for io_uring_group systl

From: Subramanya Swamy
Date: Sat Jan 20 2024 - 09:09:57 EST


Hi Jens,

           Thank you for reviewing the patch.

On 17/01/24 03:02, Jens Axboe wrote:
On 1/15/24 5:49 AM, Subramanya Swamy wrote:
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 09b6d860deba..0ed91b69643d 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -146,7 +146,9 @@ static void io_queue_sqe(struct io_kiocb *req);
struct kmem_cache *req_cachep;
static int __read_mostly sysctl_io_uring_disabled;
-static int __read_mostly sysctl_io_uring_group = -1;
+static unsigned int __read_mostly sysctl_io_uring_group;
+static unsigned int min_gid;
+static unsigned int max_gid = 4294967294; /*4294967294 is the max guid*/
As per the compile bot, these need to be under CONFIG_SYSCTL. I'd
recommend just moving them a few lines further down to do that.

I think this would be cleaner:

static unsigned int max_gid = ((gid_t) ~0U) - 1;

however, as it explains why the value is what it is rather than being
some magic constant.
Will add these changes in v2

--
Best Regards
Subramanya