[PATCH] D16805: Cast the fifth arg to mremap to void *

H.J Lu via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 2 07:44:05 PST 2016

hjl.tools created this revision.
hjl.tools added reviewers: kcc, eugenis.
hjl.tools added a subscriber: llvm-commits.

Since the prototype of mremap is

void *mremap(void *old_address, size_t old_size, size_t new_size,
	     int flags, ... /* void *new_address*/);
we need to cast new_address to void * when calling mremap.  Otherwise,
the wrong value will be passed to mremap on x32.



Index: lib/cfi/cfi.cc
--- lib/cfi/cfi.cc
+++ lib/cfi/cfi.cc
@@ -153,7 +153,7 @@
   if (main_shadow) {
     // Update.
     void *res = mremap((void *)shadow_, GetShadowSize(), GetShadowSize(),
-                       MREMAP_MAYMOVE | MREMAP_FIXED, main_shadow);
+                       MREMAP_MAYMOVE | MREMAP_FIXED, (void *)main_shadow);
     CHECK(res != MAP_FAILED);
   } else {
     // Initial setup.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16805.46653.patch
Type: text/x-patch
Size: 473 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160202/8e055448/attachment.bin>

More information about the llvm-commits mailing list