Skip to content

Commit baf5977

Browse files
committed
io_uring/register: guard compat syscall with CONFIG_COMPAT
Add compat.h include to avoid a potential build issue: io_uring/register.c:281:6: error: call to undeclared function 'in_compat_syscall'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration] if (in_compat_syscall()) { ^ 1 warning generated. io_uring/register.c:282:9: error: call to undeclared function 'compat_get_bitmap'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration] ret = compat_get_bitmap(cpumask_bits(new_mask), ^ Fixes: c432031 ("io_uring/register: move io_uring_register(2) related code to register.c") Reported-by: Manu Bretelle <chantra@meta.com> Reviewed-by: Jeff Moyer <jmoyer@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 3f30238 commit baf5977

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

io_uring/register.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/slab.h>
1515
#include <linux/uaccess.h>
1616
#include <linux/nospec.h>
17+
#include <linux/compat.h>
1718
#include <linux/io_uring.h>
1819
#include <linux/io_uring_types.h>
1920

@@ -278,13 +279,14 @@ static __cold int io_register_iowq_aff(struct io_ring_ctx *ctx,
278279
if (len > cpumask_size())
279280
len = cpumask_size();
280281

281-
if (in_compat_syscall()) {
282+
#ifdef CONFIG_COMPAT
283+
if (in_compat_syscall())
282284
ret = compat_get_bitmap(cpumask_bits(new_mask),
283285
(const compat_ulong_t __user *)arg,
284286
len * 8 /* CHAR_BIT */);
285-
} else {
287+
else
288+
#endif
286289
ret = copy_from_user(new_mask, arg, len);
287-
}
288290

289291
if (ret) {
290292
free_cpumask_var(new_mask);

0 commit comments

Comments
 (0)