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

Filipe Cabecinhas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 12 15:46:14 PDT 2018


filcab added a comment.

Thank you,
Filipe



================
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));
----------------
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.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D49252





More information about the llvm-commits mailing list