]> git.proxmox.com Git - mirror_qemu.git/commitdiff
linux-user: fix undefined shift in copy_to_user_fdset
authorAndreas Schwab <schwab@suse.de>
Tue, 9 Apr 2013 01:02:34 +0000 (01:02 +0000)
committerRiku Voipio <riku.voipio@linaro.org>
Fri, 19 Apr 2013 07:48:51 +0000 (10:48 +0300)
If TARGET_ABI_BITS is bigger than 32 we shift by more than the size of int.

Signed-off-by: Andreas Schwab <schwab@suse.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user/syscall.c

index d6d20502edf50947fe7f3ec3f93943015b059667..5a786f2fef8e3cab679e2155d3fe5ec27c9598be 100644 (file)
@@ -914,7 +914,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]);