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

Cleanup a handful of unchecked return-code issues flagged by Coverity #3180

Merged
merged 5 commits into from Dec 9, 2023

Conversation

kcgen
Copy link
Member

@kcgen kcgen commented Dec 6, 2023

Description

Fix a handful of unchecked return-code issues flagged by the updated Coverity scanner.

Related issues

2023-12-05_17-09

Manual testing

Tested shell command line handling and booting floppy and HDD images.

Also tested with UBSAN and ASAN builds.

Checklist

I have:

  • followed the project's contributing guidelines and code of conduct.
  • performed a self-review of my code.
  • commented on the particularly hard-to-understand areas of my code.
  • split my work into well-defined, bisectable commits, and I named my commits well.
  • applied the appropriate labels (bug, enhancement, refactoring, documentation, etc.)
  • checked that all my commits can be built.
  • confirmed that my code does not cause performance regressions (e.g., by running the Quake benchmark).
  • added unit tests where applicable to prove the correctness of my code and to avoid future regressions.
  • made corresponding changes to the documentation or the website according to the documentation guidelines.
  • locally verified my website or documentation changes.

@kcgen kcgen added the cleanup Non-functional changes that simplify, improve maintainability, or squash warnings label Dec 6, 2023
@kcgen kcgen self-assigned this Dec 6, 2023
src/misc/fs_utils.cpp Outdated Show resolved Hide resolved
src/misc/fs_utils.cpp Outdated Show resolved Hide resolved
include/fs_utils.h Outdated Show resolved Hide resolved
include/fs_utils.h Outdated Show resolved Hide resolved
Copy link
Collaborator

@weirddan455 weirddan455 left a comment

Choose a reason for hiding this comment

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

No comments here. Looks good 👍

@kcgen kcgen force-pushed the kc/coverity-return-codes-1 branch 6 times, most recently from 8263c65 to 02c2818 Compare December 7, 2023 00:10
After calling cmds.erase(...), 'it' becomes invalid
because we've erased the item to which it points.

Coverity doesn't like that the (now invalid) iterator 'it'
is used again on the next pass through the loop, when we
pass it to the FindEntry function.

Although we know the FindEntry function immediately
overwrites 'it', we should at least not be passing
around invalid iterators, regardless.
IF the image and boot files are truncated or corrupt, these
fseek files will fail however without checking them, we will
read or write subsequent garbage.

This commit checks the fseek result code and will log and
close the file on failure.
@kcgen
Copy link
Member Author

kcgen commented Dec 9, 2023

(Might as well get this merged)

@kcgen kcgen merged commit c62bf7a into main Dec 9, 2023
50 checks passed
@kcgen
Copy link
Member Author

kcgen commented Dec 9, 2023

Confirmed!

2023-12-08_22-53

@kcgen kcgen deleted the kc/coverity-return-codes-1 branch December 29, 2023 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Non-functional changes that simplify, improve maintainability, or squash warnings
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants