Skip to contentSkip to conversation

drm/virtio: Fix return value for VIRTGPU_CONTEXT_PARAM_DEBUG_NAME

PATCH Applied Dmitry Osipenko 2 participants 3 messages Nov 11, 2023 – Nov 15, 2023

Subsystems (3)
lore
Share & tools
lore

Dmitry Osipenko

author maintainer
#0 lore raw

PATCH 1/1 drm/virtio: Fix return value for VIRTGPU_CONTEXT_PARAM_DEBUG_NAME

The strncpy_from_user() returns number of copied bytes and not zero on success. The non-zero return value of ioctl is treated as error. Return zero on success instead of the number of copied bytes.

Fixes 7add80126bce ("drm/uapi: add explicit virtgpu context debug name")
---
 drivers/gpu/drm/virtio/virtgpu_ioctl.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/virtio/virtgpu_ioctl.c +1 -0
index 1e2042419f95..e4f76f315550 100644
@@ -665,6 +665,7 @@ static int virtio_gpu_context_init_ioctl(struct drm_device *dev,
 				goto out_unlock;
 
 			vfpriv->explicit_debug_name = true;
+			ret = 0;
 			break;
 		default:
 			ret = -EINVAL;
Signature · 1 line
2.41.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Dmitry Osipenko

The strncpy_from_user() returns number of copied bytes and not zero on success. The non-zero return value of ioctl is treated as error. Return zero on success instead of the number of copied bytes.

Fixes 7add80126bce ("drm/uapi: add explicit virtgpu context debug name")
Quoted 22 lines
---
 drivers/gpu/drm/virtio/virtgpu_ioctl.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/virtio/virtgpu_ioctl.c +1 -0
index 1e2042419f95..e4f76f315550 100644
@@ -665,6 +665,7 @@ static int virtio_gpu_context_init_ioctl(struct
 drm_device *dev,
                                goto out_unlock;
 
                        vfpriv->explicit_debug_name = true;
+                       ret = 0;
                        break;
                default:
                        ret = -EINVAL;

--
2.41.0

author maintainer Applied
#2 lore raw
In reply to Dmitry Osipenko
Quoted 15 lines · Dmitry Osipenko

The strncpy_from_user() returns number of copied bytes and not zero on success. The non-zero return value of ioctl is treated as error. Return zero on success instead of the number of copied bytes.

Fixes 7add80126bce ("drm/uapi: add explicit virtgpu context debug name")
---
 drivers/gpu/drm/virtio/virtgpu_ioctl.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/virtio/virtgpu_ioctl.c +0 -0
index 1e2042419f95..e4f76f315550 100644

drivers/gpu/drm/virtio/virtgpu_ioctl.c static int virtio_gpu_context_init_ioctl(struct drm_device *dev, · line 671

Quoted 7 lines
drivers/gpu/drm/virtio/virtgpu_ioctl.c +1 -0
@@ -665,6 +665,7 @@ static int virtio_gpu_context_init_ioctl(struct drm_device *dev,
 				goto out_unlock;
 
 			vfpriv->explicit_debug_name = true;
+			ret = 0;
 			break;
 		default:
 			ret = -EINVAL;

Applied to misc-next

Signature · 2 lines
Best regards,
Dmitry