From: Andreas Schwab Date: Tue, 9 Apr 2013 01:02:34 +0000 (+0000) Subject: linux-user: fix undefined shift in copy_to_user_fdset X-Git-Tag: v1.5.0-rc0~206^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ab709be595bef9956ea550a95e14e157cb5704e;p=thirdparty%2Fqemu.git linux-user: fix undefined shift in copy_to_user_fdset If TARGET_ABI_BITS is bigger than 32 we shift by more than the size of int. Signed-off-by: Andreas Schwab Reviewed-by: Peter Maydell Signed-off-by: Riku Voipio --- diff --git a/linux-user/syscall.c b/linux-user/syscall.c index d6d20502edf..5a786f2fef8 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -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]);