linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vdpa: fix warning casts when building with C=2
@ 2022-08-11  8:47 Stefano Garzarella
  2022-10-05 10:18 ` Stefano Garzarella
  2022-10-07 17:37 ` Eugenio Perez Martin
  0 siblings, 2 replies; 3+ messages in thread
From: Stefano Garzarella @ 2022-08-11  8:47 UTC (permalink / raw)
  To: virtualization
  Cc: linux-kernel, Michael S. Tsirkin, Jason Wang, Stefano Garzarella

Use __virtio16_to_cpu() to read `max_virtqueue_pairs` field in
virtio_net_config since its type is __virtio16.

This silences the following warning when building with `make C=2`:

    ../drivers/vdpa/vdpa.c:811:19: warning: cast to restricted __le16
    ../drivers/vdpa/vdpa.c:811:19: warning: cast from restricted __virtio16

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
---
 drivers/vdpa/vdpa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
index c06c02704461..2466d5087478 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -808,7 +808,7 @@ static int vdpa_dev_net_mq_config_fill(struct vdpa_device *vdev,
 	if ((features & BIT_ULL(VIRTIO_NET_F_MQ)) == 0)
 		return 0;
 
-	val_u16 = le16_to_cpu(config->max_virtqueue_pairs);
+	val_u16 = __virtio16_to_cpu(true, config->max_virtqueue_pairs);
 	return nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MAX_VQP, val_u16);
 }
 
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] vdpa: fix warning casts when building with C=2
  2022-08-11  8:47 [PATCH] vdpa: fix warning casts when building with C=2 Stefano Garzarella
@ 2022-10-05 10:18 ` Stefano Garzarella
  2022-10-07 17:37 ` Eugenio Perez Martin
  1 sibling, 0 replies; 3+ messages in thread
From: Stefano Garzarella @ 2022-10-05 10:18 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: linux-kernel, Jason Wang, virtualization

On Thu, Aug 11, 2022 at 10:47 AM Stefano Garzarella <sgarzare@redhat.com> wrote:
>
> Use __virtio16_to_cpu() to read `max_virtqueue_pairs` field in
> virtio_net_config since its type is __virtio16.
>
> This silences the following warning when building with `make C=2`:
>
>     ../drivers/vdpa/vdpa.c:811:19: warning: cast to restricted __le16
>     ../drivers/vdpa/vdpa.c:811:19: warning: cast from restricted __virtio16
>

I just noticed that we still have these warnings, maybe this patch has
fallen through the cracks, so I just ping kindly to include it in this
merge window :-)

Thanks,
Stefano

> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
> ---
>  drivers/vdpa/vdpa.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
> index c06c02704461..2466d5087478 100644
> --- a/drivers/vdpa/vdpa.c
> +++ b/drivers/vdpa/vdpa.c
> @@ -808,7 +808,7 @@ static int vdpa_dev_net_mq_config_fill(struct vdpa_device *vdev,
>         if ((features & BIT_ULL(VIRTIO_NET_F_MQ)) == 0)
>                 return 0;
>
> -       val_u16 = le16_to_cpu(config->max_virtqueue_pairs);
> +       val_u16 = __virtio16_to_cpu(true, config->max_virtqueue_pairs);
>         return nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MAX_VQP, val_u16);
>  }
>
> --
> 2.37.1
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] vdpa: fix warning casts when building with C=2
  2022-08-11  8:47 [PATCH] vdpa: fix warning casts when building with C=2 Stefano Garzarella
  2022-10-05 10:18 ` Stefano Garzarella
@ 2022-10-07 17:37 ` Eugenio Perez Martin
  1 sibling, 0 replies; 3+ messages in thread
From: Eugenio Perez Martin @ 2022-10-07 17:37 UTC (permalink / raw)
  To: Stefano Garzarella
  Cc: virtualization, linux-kernel, Michael S. Tsirkin, Jason Wang

On Thu, Aug 11, 2022 at 10:48 AM Stefano Garzarella <sgarzare@redhat.com> wrote:
>
> Use __virtio16_to_cpu() to read `max_virtqueue_pairs` field in
> virtio_net_config since its type is __virtio16.
>
> This silences the following warning when building with `make C=2`:
>
>     ../drivers/vdpa/vdpa.c:811:19: warning: cast to restricted __le16
>     ../drivers/vdpa/vdpa.c:811:19: warning: cast from restricted __virtio16
>
> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>

Acked-by: Eugenio Pérez <eperezma@redhat.com>

> ---
>  drivers/vdpa/vdpa.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
> index c06c02704461..2466d5087478 100644
> --- a/drivers/vdpa/vdpa.c
> +++ b/drivers/vdpa/vdpa.c
> @@ -808,7 +808,7 @@ static int vdpa_dev_net_mq_config_fill(struct vdpa_device *vdev,
>         if ((features & BIT_ULL(VIRTIO_NET_F_MQ)) == 0)
>                 return 0;
>
> -       val_u16 = le16_to_cpu(config->max_virtqueue_pairs);
> +       val_u16 = __virtio16_to_cpu(true, config->max_virtqueue_pairs);
>         return nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MAX_VQP, val_u16);
>  }
>
> --
> 2.37.1
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-07 17:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-11  8:47 [PATCH] vdpa: fix warning casts when building with C=2 Stefano Garzarella
2022-10-05 10:18 ` Stefano Garzarella
2022-10-07 17:37 ` Eugenio Perez Martin

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).