qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/3] linux-user: fix undefined shift in copy_to_user


From: riku . voipio
Subject: [Qemu-devel] [PATCH 2/3] linux-user: fix undefined shift in copy_to_user_fdset
Date: Fri, 19 Apr 2013 16:59:55 +0300

From: Andreas Schwab <address@hidden>

If TARGET_ABI_BITS is bigger than 32 we shift by more than the size of int.

Signed-off-by: Andreas Schwab <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
 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 d6d2050..5a786f2 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]);
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]