From patchwork Thu Nov 24 10:25:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 83851 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp65751qgi; Thu, 24 Nov 2016 02:27:02 -0800 (PST) X-Received: by 10.99.122.14 with SMTP id v14mr2956839pgc.31.1479983222593; Thu, 24 Nov 2016 02:27:02 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z97si10117652plh.165.2016.11.24.02.27.02; Thu, 24 Nov 2016 02:27:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964977AbcKXK05 (ORCPT + 25 others); Thu, 24 Nov 2016 05:26:57 -0500 Received: from foss.arm.com ([217.140.101.70]:46998 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938617AbcKXKZh (ORCPT ); Thu, 24 Nov 2016 05:25:37 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DB2961515; Thu, 24 Nov 2016 02:25:36 -0800 (PST) Received: from remoulade.cambridge.arm.com (flaeskesteg.cambridge.arm.com [10.1.27.175]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2A6503F318; Thu, 24 Nov 2016 02:25:35 -0800 (PST) From: Mark Rutland To: linux-kernel@vger.kernel.org Cc: dave@stgolabs.net, dbueso@suse.de, dvyukov@google.com, jasowang@redhat.com, kvm@vger.kernel.org, mark.rutland@arm.com, mst@redhat.com, netdev@vger.kernel.org, paulmck@linux.vnet.ibm.com, virtualization@lists.linux-foundation.org Subject: [PATCH 1/3] tools/virtio: fix READ_ONCE() Date: Thu, 24 Nov 2016 10:25:12 +0000 Message-Id: <1479983114-17190-2-git-send-email-mark.rutland@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479983114-17190-1-git-send-email-mark.rutland@arm.com> References: <1479983114-17190-1-git-send-email-mark.rutland@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The virtio tools implementation of READ_ONCE() has a single parameter called 'var', but erroneously refers to 'val' for its cast, and thus won't work unless there's a variable of the correct type that happens to be called 'var'. Fix this with s/var/val/, making READ_ONCE() work as expected regardless. Fixes: a7c490333df3cff5 ("tools/virtio: use virt_xxx barriers") Signed-off-by: Mark Rutland Cc: Jason Wang Cc: Michael S. Tsirkin Cc: linux-kernel@vger.kernel.org Cc: virtualization@lists.linux-foundation.org --- tools/virtio/linux/compiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 Reviewed-by: Cornelia Huck diff --git a/tools/virtio/linux/compiler.h b/tools/virtio/linux/compiler.h index 845960e..c9ccfd4 100644 --- a/tools/virtio/linux/compiler.h +++ b/tools/virtio/linux/compiler.h @@ -4,6 +4,6 @@ #define WRITE_ONCE(var, val) \ (*((volatile typeof(val) *)(&(var))) = (val)) -#define READ_ONCE(var) (*((volatile typeof(val) *)(&(var)))) +#define READ_ONCE(var) (*((volatile typeof(var) *)(&(var)))) #endif