[compiler-rt] r259540 - Cast the fifth arg to mremap to void *

Alexey Samsonov via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 2 10:36:28 PST 2016


Author: samsonov
Date: Tue Feb  2 12:36:28 2016
New Revision: 259540

URL: http://llvm.org/viewvc/llvm-project?rev=259540&view=rev
Log:
Cast the fifth arg to mremap to void *

Summary:
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.

Patch by H.J Lu!

Reviewers: kcc, eugenis, samsonov

Subscribers: samsonov, llvm-commits

Differential Revision: http://reviews.llvm.org/D16805

Modified:
    compiler-rt/trunk/lib/cfi/cfi.cc

Modified: compiler-rt/trunk/lib/cfi/cfi.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/cfi/cfi.cc?rev=259540&r1=259539&r2=259540&view=diff
==============================================================================
--- compiler-rt/trunk/lib/cfi/cfi.cc (original)
+++ compiler-rt/trunk/lib/cfi/cfi.cc Tue Feb  2 12:36:28 2016
@@ -155,7 +155,7 @@ void ShadowBuilder::Install() {
   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.




More information about the llvm-commits mailing list