minigbm: gralloc0: Fix invalid cast from integer to pointer
We should be casting a pointer to the fourcc to a char * pointer,
instead of casting the fourcc value itself (which unluckily happens to
be of the same size as pointer, so compilator fails to detect it).
BUG=b:62358788
TEST=Try to allocate with invalid usage
Change-Id: I2bb94d145dc3765d5193712aad7682c0fb383dd8
Reviewed-on: https://chromium-review.googlesource.com/566791
Commit-Ready: Tomasz Figa <tfiga@chromium.org>
Tested-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
diff --git a/cros_gralloc/gralloc0/gralloc0.cc b/cros_gralloc/gralloc0/gralloc0.cc
index 94b2031..2718e7f 100644
--- a/cros_gralloc/gralloc0/gralloc0.cc
+++ b/cros_gralloc/gralloc0/gralloc0.cc
@@ -101,7 +101,7 @@
if (!supported) {
cros_gralloc_error("Unsupported combination -- HAL format: %u, HAL flags: %u, "
"drv_format: %4.4s, drv_flags: %llu",
- format, usage, reinterpret_cast<char *>(descriptor.drm_format),
+ format, usage, reinterpret_cast<char *>(&descriptor.drm_format),
static_cast<unsigned long long>(descriptor.drv_usage));
return CROS_GRALLOC_ERROR_UNSUPPORTED;
}