lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <64117f46-6cad-afd0-7753-1636d6474731@redhat.com>
Date:   Mon, 13 Jul 2020 11:34:54 +0800
From:   Jason Wang <jasowang@...hat.com>
To:     "Michael S. Tsirkin" <mst@...hat.com>, linux-kernel@...r.kernel.org
Cc:     virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH] virtio_ring: sparse warning fixup


On 2020/7/10 下午6:49, Michael S. Tsirkin wrote:
> virtio_store_mb was built with split ring in mind so it accepts
> __virtio16 arguments. Packed ring uses __le16 values, so sparse
> complains.  It's just a store with some barriers so let's convert it to
> a macro, we don't loose too much type safety by doing that.
>
> Signed-off-by: Michael S. Tsirkin <mst@...hat.com>
> ---
>   include/linux/virtio_ring.h | 19 +++++++++----------
>   1 file changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
> index 3dc70adfe5f5..b485b13fa50b 100644
> --- a/include/linux/virtio_ring.h
> +++ b/include/linux/virtio_ring.h
> @@ -46,16 +46,15 @@ static inline void virtio_wmb(bool weak_barriers)
>   		dma_wmb();
>   }
>   
> -static inline void virtio_store_mb(bool weak_barriers,
> -				   __virtio16 *p, __virtio16 v)
> -{
> -	if (weak_barriers) {
> -		virt_store_mb(*p, v);
> -	} else {
> -		WRITE_ONCE(*p, v);
> -		mb();
> -	}
> -}
> +#define virtio_store_mb(weak_barriers, p, v) \
> +do { \
> +	if (weak_barriers) { \
> +		virt_store_mb(*p, v); \
> +	} else { \
> +		WRITE_ONCE(*p, v); \
> +		mb(); \
> +	} \
> +} while (0) \
>   
>   struct virtio_device;
>   struct virtqueue;


Acked-by: Jason Wang <jasowang@...hat.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ