* [Qemu-devel] [PATCH 2/2] Don't zero out buffer in sched_getaffinity
@ 2011-04-19 6:09 Mike McCormack
0 siblings, 0 replies; only message in thread
From: Mike McCormack @ 2011-04-19 6:09 UTC (permalink / raw)
To: riku.voipio; +Cc: Rafal Krypa, vapier, qemu-devel, stefanha
The kernel doesn't fill the buffer provided to sched_getaffinity
with zero bytes, so neither should QEMU.
Signed-off-by: Mike McCormack <mj.mccormack@samsung.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-04-19 6:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-19 6:09 [Qemu-devel] [PATCH 2/2] Don't zero out buffer in sched_getaffinity Mike McCormack
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).