]> granicus.if.org Git - strace/commitdiff
evdev.c: fix decoding of EVIOCGKEYCODE/EVIOCSKEYCODE
authorDmitry V. Levin <ldv@altlinux.org>
Fri, 27 May 2016 00:41:25 +0000 (00:41 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 28 May 2016 00:56:47 +0000 (00:56 +0000)
* evdev.c (keycode_ioctl): Use umove_or_printaddr.

evdev.c

diff --git a/evdev.c b/evdev.c
index a138edab502f725c31b89032e7c131afda61f032..4619ecb11369bf041560d99fd18ffb6cdcea14da 100644 (file)
--- a/evdev.c
+++ b/evdev.c
@@ -178,19 +178,16 @@ abs_ioctl(struct tcb *tcp, long arg)
 static int
 keycode_ioctl(struct tcb *tcp, long arg)
 {
+       tprints(", ");
+
        unsigned int keycode[2];
 
-       if (!arg) {
-               tprints(", NULL");
-               return 1;
+       if (!umove_or_printaddr(tcp, arg, &keycode)) {
+               tprintf("[%u, ", keycode[0]);
+               printxval(evdev_keycode, keycode[1], "KEY_???");
+               tprints("]");
        }
 
-       if (!verbose(tcp) || umove(tcp, arg, &keycode) < 0)
-               return 0;
-
-       tprintf(", [%u, ", keycode[0]);
-       printxval(evdev_keycode, keycode[1], "KEY_???");
-       tprints("]");
        return 1;
 }