* [PATCH] vhost: silence an unused-variable warning
@ 2019-03-06 11:05 Arnd Bergmann
2019-03-07 3:00 ` Jason Wang
2019-03-08 23:17 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Arnd Bergmann @ 2019-03-06 11:05 UTC (permalink / raw)
To: Michael S. Tsirkin, Jason Wang
Cc: Arnd Bergmann, David S. Miller, Stefan Hajnoczi, kvm,
virtualization, netdev, linux-kernel
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,
--
2.20.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] vhost: silence an unused-variable warning
2019-03-06 11:05 [PATCH] vhost: silence an unused-variable warning Arnd Bergmann
@ 2019-03-07 3:00 ` Jason Wang
2019-03-08 23:17 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: Jason Wang @ 2019-03-07 3:00 UTC (permalink / raw)
To: Arnd Bergmann, Michael S. Tsirkin
Cc: David S. Miller, Stefan Hajnoczi, kvm, virtualization, netdev,
linux-kernel
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] vhost: silence an unused-variable warning
2019-03-06 11:05 [PATCH] vhost: silence an unused-variable warning Arnd Bergmann
2019-03-07 3:00 ` Jason Wang
@ 2019-03-08 23:17 ` David Miller
2019-03-09 23:19 ` Michael S. Tsirkin
1 sibling, 1 reply; 4+ messages in thread
From: David Miller @ 2019-03-08 23:17 UTC (permalink / raw)
To: arnd; +Cc: mst, jasowang, stefanha, kvm, virtualization, netdev, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Date: Wed, 6 Mar 2019 12:05:49 +0100
> 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>
I'll apply this, thanks Arnd.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] vhost: silence an unused-variable warning
2019-03-08 23:17 ` David Miller
@ 2019-03-09 23:19 ` Michael S. Tsirkin
0 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2019-03-09 23:19 UTC (permalink / raw)
To: David Miller
Cc: arnd, jasowang, stefanha, kvm, virtualization, netdev, linux-kernel
On Fri, Mar 08, 2019 at 03:17:26PM -0800, David Miller wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> Date: Wed, 6 Mar 2019 12:05:49 +0100
>
> > 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>
>
> I'll apply this, thanks Arnd.
I queued this for next linux already and it's been in linux-next
for a while. Sorry that I didn't reply, will try to remember to do it
next time.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-03-09 23:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-06 11:05 [PATCH] vhost: silence an unused-variable warning Arnd Bergmann
2019-03-07 3:00 ` Jason Wang
2019-03-08 23:17 ` David Miller
2019-03-09 23:19 ` Michael S. Tsirkin
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).