qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] linux-user: Fix sched_getaffinity mask size


From: Samuel Thibault
Subject: [Qemu-devel] [PATCH] linux-user: Fix sched_getaffinity mask size
Date: Fri, 26 Jan 2018 19:36:36 +0100

We properly computed the capped mask size to be put to the application
buffer, but didn't actually it. Also, we need to return the capped mask
size instead of 0 on success.

Signed-off-by: Samuel Thibault <address@hidden>
---
 linux-user/syscall.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 74378947f0..cf2369aac2 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -10496,10 +10496,15 @@ abi_long do_syscall(void *cpu_env, int num, abi_long 
arg1,
                         ret = -TARGET_EINVAL;
                         break;
                     }
-                    ret = arg2;
+                } else if (arg2 > ret) {
+                    arg2 = ret;
                 }
 
                 ret = host_to_target_cpu_mask(mask, mask_size, arg3, arg2);
+
+                if (ret == 0) {
+                    ret = arg2;
+                }
             }
         }
         break;
-- 
2.15.1




reply via email to

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