[PATCH] D57863: [safestack] Simplify tinfo location calculation

Vlad Tsyrklevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 7 13:40:01 PST 2019


vlad.tsyrklevich added inline comments.


================
Comment at: compiler-rt/lib/safestack/safestack.cc:235
   void *addr = unsafe_stack_alloc(size, guard);
-  struct tinfo *tinfo =
-      (struct tinfo *)(((char *)addr) + size - sizeof(struct tinfo));
+  struct tinfo *tinfo = reinterpret_cast<struct tinfo *>(addr);
   tinfo->start_routine = start_routine;
----------------
Shouldn't this be addr+guard?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57863/new/

https://reviews.llvm.org/D57863





More information about the llvm-commits mailing list