OSDN Git Service

minigbm: gralloc0: Fix invalid cast from integer to pointer
authorTomasz Figa <tfiga@chromium.org>
Tue, 11 Jul 2017 09:07:11 +0000 (18:07 +0900)
committerchrome-bot <chrome-bot@chromium.org>
Fri, 14 Jul 2017 02:45:56 +0000 (19:45 -0700)
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>
cros_gralloc/gralloc0/gralloc0.cc

index 94b2031..2718e7f 100644 (file)
@@ -101,7 +101,7 @@ static int gralloc0_alloc(alloc_device_t *dev, int w, int h, int format, int usa
        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;
        }