minigbm: Fix cast to avoid null pointer arithmetic
'external/minigbm/cros_gralloc/gralloc0/gralloc0.cc:417:50:
error: arithmetic on a null pointer treated as a cast from
integer to pointer is a GNU extension'
BUG=b:146515640
TEST=m gralloc.minigbm
Change-Id: I2e86b676224657bdb656a45db4cfa49e84b61c2d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2202518
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Auto-Submit: Jason Macnak <natsu@google.com>
Tested-by: Jason Macnak <natsu@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
diff --git a/cros_gralloc/gralloc0/gralloc0.cc b/cros_gralloc/gralloc0/gralloc0.cc
index 6c49d3a..9f24a5d 100644
--- a/cros_gralloc/gralloc0/gralloc0.cc
+++ b/cros_gralloc/gralloc0/gralloc0.cc
@@ -414,7 +414,8 @@
return ret;
for (uint32_t plane = 0; plane < DRV_MAX_PLANES; plane++)
- addr[plane] = static_cast<uint8_t *>(nullptr) + offsets[plane];
+ addr[plane] =
+ reinterpret_cast<uint8_t *>(static_cast<uintptr_t>(offsets[plane]));
}
switch (hnd->format) {