Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dwarf: Close file descriptors in setup_dwarf_info() #1918

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

ziming-zh
Copy link
Contributor

Hello @namhyung,

I've also run Facebook's Infer tool to check for potential defection in the current code base. I've made three adjustment to close file descriptor in setup_dwarf_info function to release acquired resource in utils/dwarfs.c. I've attached the complete infer report in bugs.txt and report.csv. The other detected defects seems trivial on my side. I'd be happy if you could take a look at them as well.

Copy link
Owner

@namhyung namhyung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add "dwarf:" prefix to the subject line. Also it would be short like "dwarf: Close file descriptors in setup_dwarf_info()". And you can add the details (like it was detected by xxx tool) in the message body.

utils/dwarf.c Outdated Show resolved Hide resolved
utils/dwarf.c Outdated Show resolved Hide resolved
utils/dwarf.c Outdated Show resolved Hide resolved
This defect was detected by Facebook's Infer tool https://github.com/facebook/infer

Signed-off-by: Ziming Zhou <zimingzh@umich.edu>
@ziming-zh ziming-zh force-pushed the fix_fileclose_deallocation branch from 99ae2d9 to 4f59089 Compare April 22, 2024 21:17
@ziming-zh
Copy link
Contributor Author

Hi @namhyung, thanks for your comment! It seems that the static analysis tool Facebook.infer would generate most false positive in this case. I just put a minor fix to close the file descriptor before returning -1, not sure if it is necessary. Please close this PR and #1919 if you think it is not required. Thanks!

@ziming-zh ziming-zh requested a review from namhyung April 22, 2024 21:20
@namhyung
Copy link
Owner

namhyung commented Apr 23, 2024

Oops, I clicked a wrong button. Can you please force push the branch with the latest change and remove my merge commit?

@ziming-zh ziming-zh force-pushed the fix_fileclose_deallocation branch from 63d8f9c to 4f59089 Compare April 23, 2024 13:14
@ziming-zh
Copy link
Contributor Author

@namhyung done!

@ziming-zh ziming-zh changed the title Fix close file descriptor in setup_dwarf_info function to release acquired resource dwarf: Close file descriptors in setup_dwarf_info() Apr 23, 2024
Copy link
Owner

@namhyung namhyung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@namhyung namhyung merged commit a26f9d6 into namhyung:master Apr 24, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants