linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Arnd Bergmann <arnd@arndb.de>, "Michael S. Tsirkin" <mst@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	kvm@vger.kernel.org, virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vhost: silence an unused-variable warning
Date: Thu, 7 Mar 2019 11:00:19 +0800	[thread overview]
Message-ID: <6b55ea04-72d7-6130-e29e-977c4afad0b5@redhat.com> (raw)
In-Reply-To: <20190306110602.2529137-1-arnd@arndb.de>


On 2019/3/6 下午7:05, Arnd Bergmann wrote:
> On some architectures, the MMU can be disabled, leading to access_ok()
> becoming an empty macro that does not evaluate its size argument,
> which in turn produces an unused-variable warning:
>
> drivers/vhost/vhost.c:1191:9: error: unused variable 's' [-Werror,-Wunused-variable]
>          size_t s = vhost_has_feature(vq, VIRTIO_RING_F_EVENT_IDX) ? 2 : 0;
>
> Mark the variable as __maybe_unused to shut up that warning.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   drivers/vhost/vhost.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index a2e5dc7716e2..5ace833de746 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -1188,7 +1188,7 @@ static bool vq_access_ok(struct vhost_virtqueue *vq, unsigned int num,
>   			 struct vring_used __user *used)
>   
>   {
> -	size_t s = vhost_has_feature(vq, VIRTIO_RING_F_EVENT_IDX) ? 2 : 0;
> +	size_t s __maybe_unused = vhost_has_feature(vq, VIRTIO_RING_F_EVENT_IDX) ? 2 : 0;
>   
>   	return access_ok(desc, num * sizeof *desc) &&
>   	       access_ok(avail,


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



  reply	other threads:[~2019-03-07  3:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-06 11:05 [PATCH] vhost: silence an unused-variable warning Arnd Bergmann
2019-03-07  3:00 ` Jason Wang [this message]
2019-03-08 23:17 ` David Miller
2019-03-09 23:19   ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6b55ea04-72d7-6130-e29e-977c4afad0b5@redhat.com \
    --to=jasowang@redhat.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=stefanha@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).