Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751936AbcKYCjG (ORCPT ); Thu, 24 Nov 2016 21:39:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46482 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751171AbcKYCi7 (ORCPT ); Thu, 24 Nov 2016 21:38:59 -0500 Subject: Re: [PATCH 1/3] tools/virtio: fix READ_ONCE() To: Mark Rutland , linux-kernel@vger.kernel.org References: <1479983114-17190-1-git-send-email-mark.rutland@arm.com> <1479983114-17190-2-git-send-email-mark.rutland@arm.com> Cc: dave@stgolabs.net, dbueso@suse.de, dvyukov@google.com, kvm@vger.kernel.org, mst@redhat.com, netdev@vger.kernel.org, paulmck@linux.vnet.ibm.com, virtualization@lists.linux-foundation.org From: Jason Wang Message-ID: <8d6adf36-eff2-f698-8602-b1fe62c9d3bf@redhat.com> Date: Fri, 25 Nov 2016 10:38:42 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1479983114-17190-2-git-send-email-mark.rutland@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 25 Nov 2016 02:38:48 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1232 Lines: 33 On 2016年11月24日 18:25, Mark Rutland wrote: > 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(-) > > 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 Reviewed-by: Jason Wang