From: Dmitry V. Levin Date: Fri, 27 May 2016 00:41:34 +0000 (+0000) Subject: evdev.c: fix decoding of struct input_keymap_entry X-Git-Tag: v4.12~23 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=13f8e8fb4e37674ecf222e783be6c3e9e81c9944;p=strace evdev.c: fix decoding of struct input_keymap_entry * evdev.c (keycode_V2_ioctl): Use umove_or_printaddr. --- diff --git a/evdev.c b/evdev.c index 4619ecb1..1ffad841 100644 --- a/evdev.c +++ b/evdev.c @@ -195,21 +195,22 @@ keycode_ioctl(struct tcb *tcp, long arg) static int keycode_V2_ioctl(struct tcb *tcp, long arg) { + tprints(", "); + struct input_keymap_entry ike; - if (!arg) { - tprints(", NULL"); + if (umove_or_printaddr(tcp, arg, &ike)) return 1; - } - if (!verbose(tcp) || umove(tcp, arg, &ike) < 0) - return 0; + tprintf("{flags=%" PRIu8 + ", len=%" PRIu8 ", ", + ike.flags, + ike.len); - tprintf(", {flags=%" PRIu8 ", len=%" PRIu8, ike.flags, ike.len); if (!abbrev(tcp)) { unsigned int i; - tprintf(", index=%" PRIu16 ", keycode=", ike.index); + tprintf("index=%" PRIu16 ", keycode=", ike.index); printxval(evdev_keycode, ike.keycode, "KEY_???"); tprints(", scancode=["); for (i = 0; i < ARRAY_SIZE(ike.scancode); i++) { @@ -217,10 +218,13 @@ keycode_V2_ioctl(struct tcb *tcp, long arg) tprints(", "); tprintf("%" PRIx8, ike.scancode[i]); } - tprints("]}"); + tprints("]"); } else { - tprints(", ...}"); + tprints("..."); } + + tprints("}"); + return 1; } # endif /* EVIOCGKEYCODE_V2 */