From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55905) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPWKd-0001nC-EF for qemu-devel@nongnu.org; Tue, 09 Apr 2013 07:03:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPWKa-0002Kq-TH for qemu-devel@nongnu.org; Tue, 09 Apr 2013 07:03:19 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49803 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPWKa-00028j-No for qemu-devel@nongnu.org; Tue, 09 Apr 2013 07:03:16 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 81436A398F for ; Tue, 9 Apr 2013 13:02:34 +0200 (CEST) From: Andreas Schwab Date: Tue, 09 Apr 2013 13:02:34 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH] linux-user: fix undefined shift in copy_to_user_fdset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org If TARGET_ABI_BITS is bigger than 32 we shift by more than the size of int. Signed-off-by: Andreas Schwab --- 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 fa3039f..5abc16f 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -922,7 +922,7 @@ static inline abi_long copy_to_user_fdset(abi_ulong target_fds_addr, for (i = 0; i < nw; i++) { v = 0; for (j = 0; j < TARGET_ABI_BITS; j++) { - v |= ((FD_ISSET(k, fds) != 0) << j); + v |= ((abi_ulong)(FD_ISSET(k, fds) != 0) << j); k++; } __put_user(v, &target_fds[i]); -- 1.8.2.1 -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."