This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by filcab on Jul 12 2018, 10:12 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

filcab created this revision.Jul 12 2018, 10:12 AM
Herald added subscribers: Restricted Project, delcypher. · View Herald TranscriptJul 12 2018, 10:12 AM
eugenis added inline comments.Jul 12 2018, 10:24 AM
lib/cfi/cfi.cc
138 ↗(On Diff #155209)

memset takes an int and converts it to unsigned char, so this masking should be unnecessary.

Thank you,
Filipe

lib/cfi/cfi.cc
138 ↗(On Diff #155209)

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.

eugenis accepted this revision.Jul 12 2018, 3:56 PM
eugenis added inline comments.
lib/cfi/cfi.cc
138 ↗(On Diff #155209)

On the second thought, this is good for readability. LGTM

This revision is now accepted and ready to land.Jul 12 2018, 3:56 PM
This revision was automatically updated to reflect the committed changes.