Thread (1 message) 1 message, 1 author, 2015-01-12

Re: [PATCH 2/2] Input: uinput - fix ioctl nr overflow for UI_GET_VERSION

From: Peter Hutterer <hidden>
Date: 2015-01-12 00:37:00

On Sat, Jan 10, 2015 at 01:43:36PM +0100, Gabriel Laskar wrote:
quoted hunk
Request number for ioctls are encoded on 8bit. Values for are superior
to 255. The effective value is 0x2d. The effective ioctl number is still
the same one, it will not change the api in anyway.

Signed-off-by: Gabriel Laskar <redacted>
---
 include/uapi/linux/uinput.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/linux/uinput.h b/include/uapi/linux/uinput.h
index 358f7d9..e1daf2e 100644
--- a/include/uapi/linux/uinput.h
+++ b/include/uapi/linux/uinput.h
@@ -91,7 +91,7 @@ struct uinput_ff_erase {
  * the integer pointed to by the ioctl argument. The protocol version
  * is hard-coded in the kernel and is independent of the uinput device.
  */
-#define UI_GET_VERSION		_IOR(UINPUT_IOCTL_BASE, 301, unsigned int)
+#define UI_GET_VERSION		_IOR(UINPUT_IOCTL_BASE, 0x2d, unsigned int)
the other uinput ioctls have the number specified as decimal number, I think
the same should be done here.

Also, certainly dodged a bullet there: 301 overflows into the type field but
sets a bit that is already set by UINPUT_IOCTL_BASE so it has no effect
(which I guess is why we didn't spot this before). ACK to the patch (when
changed to decimal) but it seems applying the masks in the _IOC macro may be
prudent to avoid this in the future.

Cheers,
   Peter
 
 /*
  * To write a force-feedback-capable driver, the upload_effect
-- 
2.2.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help