From: Dmitry V. Levin Date: Fri, 27 May 2016 00:41:25 +0000 (+0000) Subject: evdev.c: fix decoding of EVIOCGKEYCODE/EVIOCSKEYCODE X-Git-Tag: v4.12~24 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7954e2a7113ba4f2d110f2376b4c0d98756b5cfe;p=strace evdev.c: fix decoding of EVIOCGKEYCODE/EVIOCSKEYCODE * evdev.c (keycode_ioctl): Use umove_or_printaddr. --- diff --git a/evdev.c b/evdev.c index a138edab..4619ecb1 100644 --- 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; }