bvb_refimpl: fix pointer-to-int-cast compiler error

error: cast from pointer to integer of different size
   if (!bvb_safe_add(NULL, (uint64_t) data, length)) {

The error means that converting a pointer to unsigned int can be

We converts a pointer to 64bit unsigned int which is safe (at
least till we are not going to run this code on 128bit system for
We can make compiler happy by useing uintptr_t as a temp variable.
uintptr_t is guaranteed to be wide enough that converting a pointer
to uintptr_t and back again will yield the original pointer value.

Change-Id: Id94e83942bd2f63fdbd9f8da04d2d4a5892e26c2
Signed-off-by: Dzmitry Yatsushkevich <>
diff --git a/refimpl/bvb_verify.c b/refimpl/bvb_verify.c
index 45b675e..dc05580 100644
--- a/refimpl/bvb_verify.c
+++ b/refimpl/bvb_verify.c
@@ -164,8 +164,9 @@
     goto out;
+  uintptr_t data_ptr = (uintptr_t) data;
   /* Ensure passed in memory doesn't wrap. */
-  if (!bvb_safe_add(NULL, (uint64_t) data, length)) {
+  if (!bvb_safe_add(NULL, (uint64_t) data_ptr, length)) {
     bvb_debug("Boot image location and length mismatch.\n");
     goto out;