external/drm_gralloc: Remove the invalid int cast and assignment in gbm_mod_perform()

Message ID 1490759316-11817-1-git-send-email-john.stultz@linaro.org
State New
Headers show

Commit Message

John Stultz March 29, 2017, 3:48 a.m.
In gbm_mod_perform(), for the cmd GRALLOC_MODULE_PERFORM_GET_USAGE,
the code takes the third argument, casts it as an int* and then writes
a zero into what the pointer points to.

The problem with this is that the third argument to that function is
actually a native_handle_t, so writing zero to the first int in that
structure ends up overwriting the version value, causing the
native_handle_t code to see the value as corrupt.

This results in lots of warnings and leaked fds.

Cc: Rob Herring <rob.herring@linaro.org>
Cc: Amit Pundir <amit.pundir@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Vishal Bhoj <vishal.bhoj@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>

 gralloc.cpp | 2 --
 1 file changed, 2 deletions(-)



diff --git a/gralloc.cpp b/gralloc.cpp
index 01a1c6f..ec7638f 100644
--- a/gralloc.cpp
+++ b/gralloc.cpp
@@ -117,8 +117,6 @@  static int gbm_mod_perform(const struct gralloc_module_t *mod, int op, ...)
 	/* TODO: This is a stub and should be implemented fully */
-			int *buffer_usage = va_arg(args, int *);
-			*buffer_usage = 0;
 			err = 0;