[PATCH] drmPrime*: initialize output args to 0
On Tue, 2015-05-05 at 16:12 +0100, Emil Velikov wrote: > As mentioned before one could add the appropriate Valgrind > annotations. Although using memclear() or this will do just fine :-) > Any objections against memclear ? it will save us some head-scratching > when/if someone decides to extend struct drm_prime_handle. If you and > others are ok with it, I'll amend the patch locally before pushing in > the next week or so. Yeah memclear sounds like a good idea to me as well. G.
[PATCH] drmPrime*: initialize output args to 0
Hi Guillaume, On 29 April 2015 at 09:16, Guillaume Desmottes wrote: > Fix Valgrind errors because those memory was uninitialized. > > https://bugs.freedesktop.org/show_bug.cgi?id=90194 > Signed-off-by: Guillaume Desmottes > --- > 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, ); > @@ -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, ); As mentioned before one could add the appropriate Valgrind annotations. Although using memclear() or this will do just fine :-) Any objections against memclear ? it will save us some head-scratching when/if someone decides to extend struct drm_prime_handle. If you and others are ok with it, I'll amend the patch locally before pushing in the next week or so. Thanks Emil
[PATCH] drmPrime*: initialize output args to 0
Fix Valgrind errors because those memory was uninitialized. https://bugs.freedesktop.org/show_bug.cgi?id=90194 Signed-off-by: Guillaume Desmottes --- 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, ); @@ -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, ); -- 2.1.0
[PATCH] drmPrime*: initialize output args to 0
Fix Valgrind errors because those memory was uninitialized. https://bugs.freedesktop.org/show_bug.cgi?id=90194 Signed-off-by: Guillaume Desmottes --- xf86drm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xf86drm.c b/xf86drm.c index f7c45f8..f3f84df 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 = 0; args.handle = handle; args.flags = flags; ret = drmIoctl(fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, ); @@ -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, ); -- 2.1.0