[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/2] Don't zero out buffer in sched_getaffinity
From: |
Mike McCormack |
Subject: |
[Qemu-devel] [PATCH 2/2] Don't zero out buffer in sched_getaffinity |
Date: |
Tue, 19 Apr 2011 15:09:52 +0900 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 |
The kernel doesn't fill the buffer provided to sched_getaffinity
with zero bytes, so neither should QEMU.
Signed-off-by: Mike McCormack <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
---
linux-user/syscall.c | 13 +------------
1 files changed, 1 insertions(+), 12 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1cda10a..e53b7e5 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6384,20 +6384,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
arg1,
ret = get_errno(sys_sched_getaffinity(arg1, mask_size, mask));
if (!is_error(ret)) {
- if (arg2 > ret) {
- /* Zero out any extra space kernel didn't fill */
- unsigned long zero = arg2 - ret;
- p = alloca(zero);
- memset(p, 0, zero);
- if (copy_to_user(arg3 + ret, p, zero)) {
- goto efault;
- }
- arg2 = ret;
- }
- if (copy_to_user(arg3, mask, arg2)) {
+ if (copy_to_user(arg3, mask, ret)) {
goto efault;
}
- ret = arg2;
}
}
break;
--
1.7.0.4
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [PATCH 2/2] Don't zero out buffer in sched_getaffinity,
Mike McCormack <=