[PATCH] drmPrime*: initialize output args to 0

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Wed Apr 29 01:16:22 PDT 2015


Fix Valgrind errors because those memory was uninitialized.

https://bugs.freedesktop.org/show_bug.cgi?id=90194
Signed-off-by: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
---
 xf86drm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xf86drm.c b/xf86drm.c
index f7c45f8..01c398e 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -2724,6 +2724,7 @@ int drmPrimeHandleToFD(int fd, uint32_t handle, uint32_t flags, int *prime_fd)
 	struct drm_prime_handle args;
 	int ret;
 
+	args.fd = -1;
 	args.handle = handle;
 	args.flags = flags;
 	ret = drmIoctl(fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &args);
@@ -2739,6 +2740,7 @@ int drmPrimeFDToHandle(int fd, int prime_fd, uint32_t *handle)
 	struct drm_prime_handle args;
 	int ret;
 
+	args.handle = 0;
 	args.fd = prime_fd;
 	args.flags = 0;
 	ret = drmIoctl(fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &args);
-- 
2.1.0



More information about the dri-devel mailing list