diff options
| author | Jens Axboe <axboe@kernel.dk> | 2026-01-12 18:14:41 +0300 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-01-13 20:30:41 +0300 |
| commit | 51fff55a66d89d76fcaeaa277d53bdf5b19efa0e (patch) | |
| tree | 5b78fe6829efb8ab03cc05cd75806e2d15e05f95 | |
| parent | 130a82760718997806a618490f5b7ab06932bd9c (diff) | |
| download | linux-51fff55a66d89d76fcaeaa277d53bdf5b19efa0e.tar.xz | |
io_uring/register: have io_parse_restrictions() return number of ops
Rather than return 0 on success, return >= 0 for success, where the
return value is that number of parsed entries. As before, any < 0
return is an error.
Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
| -rw-r--r-- | io_uring/register.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/io_uring/register.c b/io_uring/register.c index a3fef649272b..4d4e7420e7c6 100644 --- a/io_uring/register.c +++ b/io_uring/register.c @@ -103,6 +103,10 @@ static int io_register_personality(struct io_ring_ctx *ctx) return id; } +/* + * Returns number of restrictions parsed and added on success, or < 0 for + * an error. + */ static __cold int io_parse_restrictions(void __user *arg, unsigned int nr_args, struct io_restriction *restrictions) { @@ -145,9 +149,7 @@ static __cold int io_parse_restrictions(void __user *arg, unsigned int nr_args, goto err; } } - - ret = 0; - + ret = nr_args; err: kfree(res); return ret; @@ -168,11 +170,12 @@ static __cold int io_register_restrictions(struct io_ring_ctx *ctx, ret = io_parse_restrictions(arg, nr_args, &ctx->restrictions); /* Reset all restrictions if an error happened */ - if (ret != 0) + if (ret < 0) { memset(&ctx->restrictions, 0, sizeof(ctx->restrictions)); - else - ctx->restrictions.registered = true; - return ret; + return ret; + } + ctx->restrictions.registered = true; + return 0; } static int io_register_enable_rings(struct io_ring_ctx *ctx) |
