From patchwork Thu Jan 31 12:50:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 14382 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id C46F423F96 for ; Thu, 31 Jan 2013 12:50:50 +0000 (UTC) Received: from mail-vb0-f44.google.com (mail-vb0-f44.google.com [209.85.212.44]) by fiordland.canonical.com (Postfix) with ESMTP id 2246EA18A74 for ; Thu, 31 Jan 2013 12:50:50 +0000 (UTC) Received: by mail-vb0-f44.google.com with SMTP id fc26so1744482vbb.3 for ; Thu, 31 Jan 2013 04:50:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=Pi2M78Cbm6LFCmHCMoB9yAc/8QI45bULTjMVVA8WAos=; b=gJvaC6bvOmLVGIvsblnDYb6J1/J414nWAfoH86d5ER7u5GxSDPiQNfiJW/Sam5OPvI lmN+A/luw2BNfjo+bG2DihTlH78XxjvR+e/VwFezCYlbeqPm9QaXQm6AdyBXE/YHD2KU EiMzEdhV+FGFMIoes4HKypQq4Xwq0Mu+F+pET/Y3LM1dTlVt0L/S9SkZxtcXDWCDqbTk ANdZynrqCaVUyFFpQq8lS3qEgWR3ITq6Mx8UMrAHMB+viEvhs1eadIfZLGtQ7ae4rVWv yWxwVqTJU+F6HxVQ5qqJmbzWINNMGtCX1IcRWA+aCtiiKttualQhT1mIH7OBADLwAMhb ZQUQ== X-Received: by 10.52.21.146 with SMTP id v18mr6838578vde.79.1359636649461; Thu, 31 Jan 2013 04:50:49 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.252.8 with SMTP id zo8csp61870vec; Thu, 31 Jan 2013 04:50:44 -0800 (PST) X-Received: by 10.180.81.39 with SMTP id w7mr14944206wix.15.1359636644113; Thu, 31 Jan 2013 04:50:44 -0800 (PST) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id fb6si3140099wib.59.2013.01.31.04.50.43 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 31 Jan 2013 04:50:44 -0800 (PST) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Authentication-Results: mx.google.com; spf=neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1U0tbE-0006F1-31; Thu, 31 Jan 2013 12:50:40 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Richard Henderson , Alexander Graf , Laurent Desnogues , Blue Swirl , Riku Voipio Subject: [PATCH for-1.4] linux-user: Restore cast to target type in get_user() Date: Thu, 31 Jan 2013 12:50:40 +0000 Message-Id: <1359636640-23968-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-Gm-Message-State: ALoCoQkfLJd8DcH4tLUvZajw/Xw8iw1HpZoorUpljU9XqmhjhJMLRX6YB8i1W4gP75D76bujFWrg Commit 658f2dc97 accidentally dropped the cast to the target type of the value loaded by get_user(). The most visible effect of this would be that the sequence "uint64_t v; get_user_u32(v, addr)" would sign extend the 32 bit loaded value into v rather than zero extending as would be expected for a _u32 accessor. Put the cast back again to restore the old behaviour. Signed-off-by: Peter Maydell Reviewed-by: Laurent Desnogues Reviewed-by: Richard Henderson --- linux-user/qemu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 31a220a..b10e957 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -306,12 +306,12 @@ static inline int access_ok(int type, abi_ulong addr, abi_ulong size) ((hptr), (x)), 0) #define __get_user_e(x, hptr, e) \ - ((x) = \ + ((x) = (typeof(*hptr))( \ __builtin_choose_expr(sizeof(*(hptr)) == 1, ldub_p, \ __builtin_choose_expr(sizeof(*(hptr)) == 2, lduw_##e##_p, \ __builtin_choose_expr(sizeof(*(hptr)) == 4, ldl_##e##_p, \ __builtin_choose_expr(sizeof(*(hptr)) == 8, ldq_##e##_p, abort)))) \ - (hptr), 0) + (hptr)), 0) #ifdef TARGET_WORDS_BIGENDIAN # define __put_user(x, hptr) __put_user_e(x, hptr, be)