-
Notifications
You must be signed in to change notification settings - Fork 7
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
Static Analysis Fixes #44
Merged
nick-child-ibm
merged 49 commits into
open-power:guest-devel
from
erichte-ibm:erichte/static-analysis-fixes
Aug 3, 2023
Merged
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
82a374b
Makefile: add cppcheck static analysis target similar to libstb-secvar's
erichte-ibm 2262f6b
guest/generate: remove always true conditions as reported by cppcheck
erichte-ibm 2923b33
guest/generate: fix incorrect allocation check
erichte-ibm 69c9284
guest/generate: unsigned (size_t) variables cannot be less than zero
erichte-ibm f4a14f0
guest/read: change printf format specifier to %zu to match variable type
erichte-ibm 540d15b
guest/valdiate: change printf format specific to %zu to match variabl…
erichte-ibm 92238b2
guest/validate: actually make a forward declartion of rc useful
erichte-ibm dff2217
guest/validate: put variables only used in an #ifdef also behind the …
erichte-ibm e33725b
guest/read: reduce scope of loop-only variables
erichte-ibm f605eae
guest/verify: refactor get_pk_and_kek_from_update_var()
erichte-ibm 3d80649
guest/verify: functions should not just be one giant conditional
erichte-ibm a30dbe7
guest/verify: reduce the scope of the loop index
erichte-ibm dffda50
guest/read: size_t variables literally can't be -1
erichte-ibm 5789c41
guest/read: size_t = %zu
erichte-ibm 652864b
guest/read: reduce scope of variables that are only used by WRITE_FUN…
erichte-ibm 2f0b468
guest/verify: remove extraneous code after break in parse_options
erichte-ibm ee5f417
generic: remove unusued function get_leading_whitespace
erichte-ibm b0588e2
host/generate: fix invalid malloc return check
erichte-ibm cb12c58
backends/host: unsigned integers still can't be less than zero
erichte-ibm 45081f4
host/read: reduce the scope of variables in printReadable
erichte-ibm c06d938
host/read: fix weird pointer increment in readTS
erichte-ibm fd03f0d
host/validate: reduce scope of variables
erichte-ibm 109a579
host/validate: add a NULL check to the **x509 parameter of parseX509
erichte-ibm 470ef5c
host/verify: remove assignment with no effect
erichte-ibm 71ee02a
host/validate: change ts_ptr to const in timestamp_is_empty
erichte-ibm 81758e8
host/verify: remove redundant check, as <= 1 implies !
erichte-ibm d702bd4
guest: use system endian.h, as it's entirely ambiguous which endian.h…
erichte-ibm 1146beb
Makefile: fix include pathing for cppcheck
erichte-ibm d5cc405
guest/generate: fix format string typing (int -> uint)
erichte-ibm 6c7366a
guest/read: fix format string typing
erichte-ibm 3b1ba71
guest/validate: remove needless esl_size variable alias from validate…
erichte-ibm b606dee
guest/validate: fix format string typing
erichte-ibm 161591c
guest/validate: unsigned integers still can't be less than zero
erichte-ibm 16e257b
guest/verify: remove redundant check, unsigned less than 0, etc etc
erichte-ibm 0ccabc9
more unsigned printf fixes
erichte-ibm c96d802
host/validate: %zu
erichte-ibm 947ab14
host/validate: remove useless eslsize alias
erichte-ibm 4cf8030
host/validate: always free a buffer that always exists
erichte-ibm 391cd0d
host/validate: unsigned still can't be less than zero
erichte-ibm d2c4ed2
guest/read: remove conditional that is always true in read_auth
erichte-ibm 5518ca2
host/read: standard for unsigned unchanged, still cannot be less than…
erichte-ibm 0617f05
host/generate: check that ESL is not NULL is getPreHashForSecVar
erichte-ibm 49cbda7
guest/read: check auth_data is not NULL in read_auth
erichte-ibm 8f6703e
host/verify: fix potential memory leak in setupBanks
erichte-ibm 16a6f32
guest/verify: fix potential double free in get_pk_and_kek from update…
erichte-ibm b0da6ee
host/generate: fix unsigned printf format strings with CRYPTO_WRITE_F…
erichte-ibm 9878d6f
Makefile/cppcheck: suppress false positives, reorganize cppcheck flag…
erichte-ibm 1e4202d
guest/verify: display usage if arguments fail to validate
erichte-ibm 4af5d99
guest/validate: reduce scope of rc in validate_esl
erichte-ibm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, we should split this into smaller functions.
But if you are going to reduce scope of variables then you might as well go all the way:
data_size
is useless and can be removed and replaced withcert_size
cert_size
,esd
can be declared in the second loopsignature_type
,sig_list
can go in first loopoffset
is being used properly in this function at all, in the first loop we use it for offset to the next ESL header, in the second, loop we use it as an offset to the ESL data. I doubt this works if there are ever two appended ESL structures (which I believe is possible with dbx, unless something changed)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this was mostly to silence cppcheck warnings, most of the rest of the scope reductions will probably be removed with a function rewrite. Skipping for now.