From: riku.voipio@iki.fi
To: qemu-devel@nongnu.org
Cc: Mike McCormack <mj.mccormack@samsung.com>,
Riku Voipio <riku.voipio@iki.fi>
Subject: [Qemu-devel] [PATCH 3/3] Don't zero out buffer in sched_getaffinity
Date: Mon, 2 May 2011 12:19:10 +0300 [thread overview]
Message-ID: <1304327950-21422-4-git-send-email-riku.voipio@iki.fi> (raw)
In-Reply-To: <1304327950-21422-1-git-send-email-riku.voipio@iki.fi>
From: Mike McCormack <mj.mccormack@samsung.com>
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>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
---
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 5b7b8e2..279cef3 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6500,20 +6500,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.4.1
next prev parent reply other threads:[~2011-05-02 9:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-02 9:19 [Qemu-devel] [PATCH 0/3] [PULL] linux-user fixes riku.voipio
2011-05-02 9:19 ` [Qemu-devel] [PATCH 1/3] linux-user: Fix compilation for "old" linux versions riku.voipio
2011-05-02 9:19 ` [Qemu-devel] [PATCH 2/3] Fix buffer overrun in sched_getaffinity riku.voipio
2011-05-02 9:19 ` riku.voipio [this message]
2011-05-02 10:15 ` [Qemu-devel] [PATCH 0/3] [PULL] linux-user fixes Edgar E. Iglesias
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1304327950-21422-4-git-send-email-riku.voipio@iki.fi \
--to=riku.voipio@iki.fi \
--cc=mj.mccormack@samsung.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).