This is an archive of the discontinued LLVM Phabricator instance.

MallocChecker, adding specific BSD calls
AbandonedPublic

Authored by devnexen on Apr 1 2018, 1:38 PM.

Details

Reviewers
NoQ
jdenny
Summary
  • reallocarray/recallocarray
  • freezero

Diff Detail

Event Timeline

devnexen created this revision.Apr 1 2018, 1:38 PM
NoQ added a comment.Apr 1 2018, 2:35 PM

Nice, thanks.

lib/StaticAnalyzer/Checkers/MallocChecker.cpp
704–710

These lists are getting long, i guess they should be refactored into a simple II -> Kind pointer map lookup eventually.

923–928

The moved array is not all zeros, just the new part, right? It should be more accurate to realloc() here. Not sure if we actually model realloc() by moving memory contents (at least, i'm sure we're not modeling it perfectly). If we simply invalidate the newly allocated region, it should be fine to simply re-use ReallocMemAux() here. If we try to mark the newly added bytes as uninitialized, then you might need to pass a flag to zero-initialize them instead.

devnexen updated this revision to Diff 140607.Apr 2 2018, 12:29 AM

Using groups of functions.

jdenny added a comment.Apr 9 2018, 2:21 PM

Hi David. While I did make some superficial changes here recently, I'm no authority on what belongs here. However, I would suggest that the refactoring patch be split from the original patch. Thanks.

These calls are not 'BSD' specific.. but OpenBSD.

Hi David. While I did make some superficial changes here recently, I'm no authority on what belongs here. However, I would suggest that the refactoring patch be split from the original patch. Thanks.

True you re right. And should rename it once I got back to it my initial plan was with more functions but finally ended up with those OpenBSD specifics.

devnexen abandoned this revision.May 6 2018, 8:11 AM