This is an archive of the discontinued LLVM Phabricator instance.

[clang][analyzer] Fix StdLibraryFunctionsChecker 'mkdir' return value.
ClosedPublic

Authored by balazske on Jun 8 2022, 2:36 AM.

Details

Summary

The functions 'mkdir', 'mknod', 'mkdirat', 'mknodat' return 0 on success
and -1 on failure. The checker modeled these functions with a >= 0
return value on success which is changed to 0 only. This fix makes
ErrnoChecker work better for these functions.

Diff Detail

Event Timeline

balazske created this revision.Jun 8 2022, 2:36 AM
Herald added a project: Restricted Project. · View Herald Transcript
balazske requested review of this revision.Jun 8 2022, 2:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2022, 2:36 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
steakhal accepted this revision.Jun 8 2022, 6:36 AM

Note in the summary that this patch affects:

  • mkdir, mkdirat
  • mknod, mknodat

The checker modeled these functions with a >= 0 return value on success which is incorrect.

Technically, it was correct previously. Now it's not only correct but also precise ;)

This revision is now accepted and ready to land.Jun 8 2022, 6:36 AM
balazske edited the summary of this revision. (Show Details)Jun 8 2022, 8:09 AM

This looks like a standalone patch.
Feel free to rebase to main and land it.

steakhal accepted this revision.Jun 17 2022, 10:43 AM

It feels like the parent revision is not correct.
Land it.

This revision was landed with ongoing or failed builds.Jun 23 2022, 2:29 AM
This revision was automatically updated to reflect the committed changes.