linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] virtio_config: clarify output parameters
@ 2025-08-29 15:09 Alyssa Ross
  2025-09-02 11:56 ` Stefan Hajnoczi
  0 siblings, 1 reply; 2+ messages in thread
From: Alyssa Ross @ 2025-08-29 15:09 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Jason Wang, Xuan Zhuo, Eugenio Pérez, virtualization,
	linux-kernel

This was ambiguous enough for a broken patch (206cc44588f7 ("virtio:
reject shm region if length is zero")) to make it into the kernel, so
make it clearer.

Link: https://lore.kernel.org/r/20250816071600-mutt-send-email-mst@kernel.org/
Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
 include/linux/virtio_config.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 8bf156dde554..7427b79d6f3d 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -193,14 +193,15 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev,
 }
 
 static inline void virtio_get_features(struct virtio_device *vdev,
-				       u64 *features)
+				       u64 *features_out)
 {
 	if (vdev->config->get_extended_features) {
-		vdev->config->get_extended_features(vdev, features);
+		vdev->config->get_extended_features(vdev, features_out);
 		return;
 	}
 
-	virtio_features_from_u64(features, vdev->config->get_features(vdev));
+	virtio_features_from_u64(features_out,
+		vdev->config->get_features(vdev));
 }
 
 /**
@@ -326,11 +327,11 @@ int virtqueue_set_affinity(struct virtqueue *vq, const struct cpumask *cpu_mask)
 
 static inline
 bool virtio_get_shm_region(struct virtio_device *vdev,
-			   struct virtio_shm_region *region, u8 id)
+			   struct virtio_shm_region *region_out, u8 id)
 {
 	if (!vdev->config->get_shm_region)
 		return false;
-	return vdev->config->get_shm_region(vdev, region, id);
+	return vdev->config->get_shm_region(vdev, region_out, id);
 }
 
 static inline bool virtio_is_little_endian(struct virtio_device *vdev)

base-commit: 07d9df80082b8d1f37e05658371b087cb6738770
-- 
2.50.1


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

* Re: [PATCH] virtio_config: clarify output parameters
  2025-08-29 15:09 [PATCH] virtio_config: clarify output parameters Alyssa Ross
@ 2025-09-02 11:56 ` Stefan Hajnoczi
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2025-09-02 11:56 UTC (permalink / raw)
  To: Alyssa Ross
  Cc: Michael S. Tsirkin, Jason Wang, Xuan Zhuo, Eugenio Pérez,
	virtualization, linux-kernel

On Fri, Aug 29, 2025 at 11:10 AM Alyssa Ross <hi@alyssa.is> wrote:
>
> This was ambiguous enough for a broken patch (206cc44588f7 ("virtio:
> reject shm region if length is zero")) to make it into the kernel, so
> make it clearer.
>
> Link: https://lore.kernel.org/r/20250816071600-mutt-send-email-mst@kernel.org/
> Signed-off-by: Alyssa Ross <hi@alyssa.is>
> ---
>  include/linux/virtio_config.h | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

>
> diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
> index 8bf156dde554..7427b79d6f3d 100644
> --- a/include/linux/virtio_config.h
> +++ b/include/linux/virtio_config.h
> @@ -193,14 +193,15 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev,
>  }
>
>  static inline void virtio_get_features(struct virtio_device *vdev,
> -                                      u64 *features)
> +                                      u64 *features_out)
>  {
>         if (vdev->config->get_extended_features) {
> -               vdev->config->get_extended_features(vdev, features);
> +               vdev->config->get_extended_features(vdev, features_out);
>                 return;
>         }
>
> -       virtio_features_from_u64(features, vdev->config->get_features(vdev));
> +       virtio_features_from_u64(features_out,
> +               vdev->config->get_features(vdev));
>  }
>
>  /**
> @@ -326,11 +327,11 @@ int virtqueue_set_affinity(struct virtqueue *vq, const struct cpumask *cpu_mask)
>
>  static inline
>  bool virtio_get_shm_region(struct virtio_device *vdev,
> -                          struct virtio_shm_region *region, u8 id)
> +                          struct virtio_shm_region *region_out, u8 id)
>  {
>         if (!vdev->config->get_shm_region)
>                 return false;
> -       return vdev->config->get_shm_region(vdev, region, id);
> +       return vdev->config->get_shm_region(vdev, region_out, id);
>  }
>
>  static inline bool virtio_is_little_endian(struct virtio_device *vdev)
>
> base-commit: 07d9df80082b8d1f37e05658371b087cb6738770
> --
> 2.50.1
>
>

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

end of thread, other threads:[~2025-09-02 11:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-29 15:09 [PATCH] virtio_config: clarify output parameters Alyssa Ross
2025-09-02 11:56 ` Stefan Hajnoczi

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