From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45579) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0z9j-0008Lg-3a for qemu-devel@nongnu.org; Tue, 16 Dec 2014 15:55:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y0z9c-0003uq-Kp for qemu-devel@nongnu.org; Tue, 16 Dec 2014 15:55:43 -0500 Received: from mail-pa0-f47.google.com ([209.85.220.47]:61014) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0z9c-0003ud-2B for qemu-devel@nongnu.org; Tue, 16 Dec 2014 15:55:36 -0500 Received: by mail-pa0-f47.google.com with SMTP id kq14so14858738pab.20 for ; Tue, 16 Dec 2014 12:55:35 -0800 (PST) From: Ed Swierk Date: Tue, 16 Dec 2014 12:55:31 -0800 Message-Id: <1418763331-115575-1-git-send-email-eswierk@skyportsystems.com> Subject: [Qemu-devel] [PATCH] linux-user: Fix ioctl cmd type mismatch on 64-bit targets List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: eswierk@skyportsystems.com linux-user passes the cmd argument of the ioctl syscall as a signed long, but compares it to an unsigned int when iterating through the ioctl_entries list. When the cmd is a large value like 0x80047476 (TARGET_TIOCSWINSZ on mips64) it gets sign-extended to 0xffffffff80047476, causing the comparison to fail and resulting in lots of spurious "Unsupported ioctl" errors. Changing the target_cmd field in the ioctl_entries list to a signed int causes those values to be sign-extended as well during the comparison. Signed-off-by: Ed Swierk --- linux-user/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index aaac6a2..d636c81 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -3278,7 +3278,7 @@ typedef abi_long do_ioctl_fn(const IOCTLEntry *ie, uint8_t *buf_temp, int fd, abi_long cmd, abi_long arg); struct IOCTLEntry { - unsigned int target_cmd; + int target_cmd; unsigned int host_cmd; const char *name; int access; -- 1.9.1