From patchwork Fri Feb 25 10:27:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 217 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:40:57 -0000 Delivered-To: patches@linaro.org Received: by 10.224.19.208 with SMTP id c16cs388747qab; Fri, 25 Feb 2011 02:27:48 -0800 (PST) Received: by 10.216.183.145 with SMTP id q17mr1897784wem.5.1298629666840; Fri, 25 Feb 2011 02:27:46 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk [81.2.115.146]) by mx.google.com with ESMTPS id q53si883831wep.125.2011.02.25.02.27.44 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 25 Feb 2011 02:27:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1Psutg-0006Dw-HX; Fri, 25 Feb 2011 10:27:40 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: Riku Voipio , patches@linaro.org Subject: [PATCH] linux-user: Fix unlock_user() call in return from poll() Date: Fri, 25 Feb 2011 10:27:40 +0000 Message-Id: <1298629660-23901-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.3 Correct the broken attempt to calculate the third argument to unlock_user() in the code path which unlocked the pollfd array on return from poll() and ppoll() emulation. (This only caused a problem if unlock_user() wasn't a no-op, eg if DEBUG_REMAP is defined.) Signed-off-by: Peter Maydell --- linux-user/syscall.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index cf8a4c3..822b863 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6314,10 +6314,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, for(i = 0; i < nfds; i++) { target_pfd[i].revents = tswap16(pfd[i].revents); } - ret += nfds * (sizeof(struct target_pollfd) - - sizeof(struct pollfd)); } - unlock_user(target_pfd, arg1, ret); + unlock_user(target_pfd, arg1, sizeof(struct target_pollfd) * nfds); } break; #endif