[PATCH v2 2/2] Input: uinput: return -EINVAL for out-of-range UI_ABS_SETUP axis code
From: Iván Ezequiel Rodriguez
Date: Mon Aug 31 2026 - 16:04:39 EST
uinput_abs_setup() rejects an axis code above ABS_MAX with -ERANGE, but
the UI_ABS_SETUP documentation in include/uapi/linux/uinput.h states the
ioctl may only fail with -EINVAL, -ENOMEM or -EFAULT. An out-of-range
code is exactly the "incorrect values" case described there, and every
other validation failure in this path already returns -EINVAL.
Return -EINVAL so the code matches its documented uapi contract.
Signed-off-by: Iván Ezequiel Rodriguez <ivanrwcm25@xxxxxxxxx>
---
drivers/input/misc/uinput.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index d32fa4b508fc..7d6266c2bd84 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -524,7 +524,7 @@ static int uinput_abs_setup(struct uinput_device *udev,
return -EFAULT;
if (setup.code > ABS_MAX)
- return -ERANGE;
+ return -EINVAL;
dev = udev->dev;
--
2.43.0