[PATCH] D49252: [cfi] Don't pass a uint16_t to memset. Make sure the 16-bit constant is appropriate for us.

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 12 15:56:20 PDT 2018


eugenis accepted this revision.
eugenis added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lib/cfi/cfi.cc:138
+  static_assert(kUncheckedShadow & 0xff == ((kUncheckedShadow >> 8) & 0xff));
+  memset(shadow_begin, kUncheckedShadow & 0xff,
          (shadow_end - shadow_begin) * sizeof(*shadow_begin));
----------------
filcab wrote:
> eugenis wrote:
> > memset takes an int and converts it to unsigned char, so this masking should be unnecessary.
> True, I ended up adding this because one of our static analyzers complained about a suspicious integer being passed to `memset`. I can fix it locally only if it's preferred, though.
On the second thought, this is good for readability. LGTM


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D49252





More information about the llvm-commits mailing list