Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+10 -7
+10 -7
io_uring/register.c
··· 103 103 return id; 104 104 } 105 105 106 + /* 107 + * Returns number of restrictions parsed and added on success, or < 0 for 108 + * an error. 109 + */ 106 110 static __cold int io_parse_restrictions(void __user *arg, unsigned int nr_args, 107 111 struct io_restriction *restrictions) 108 112 { ··· 149 145 goto err; 150 146 } 151 147 } 152 - 153 - ret = 0; 154 - 148 + ret = nr_args; 155 149 err: 156 150 kfree(res); 157 151 return ret; ··· 170 168 171 169 ret = io_parse_restrictions(arg, nr_args, &ctx->restrictions); 172 170 /* Reset all restrictions if an error happened */ 173 - if (ret != 0) 171 + if (ret < 0) { 174 172 memset(&ctx->restrictions, 0, sizeof(ctx->restrictions)); 175 - else 176 - ctx->restrictions.registered = true; 177 - return ret; 173 + return ret; 174 + } 175 + ctx->restrictions.registered = true; 176 + return 0; 178 177 } 179 178 180 179 static int io_register_enable_rings(struct io_ring_ctx *ctx)