-
Notifications
You must be signed in to change notification settings - Fork 332
Misc fixups from scan-build. #477
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
Merged
Merged
Conversation
This file contains hidden or 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
When using clang-analyzer, scan-build sets CC to /usr/bin/../libexec/ccc-analyzer, which for whatever reason when we're in the sub-make to build gnu-efi, then gets confused and invokes gcc rather than clang. This causes gnu-efi's attempt to check which compiler it's using to fail, because "/usr/bin/../libexec/ccc-analyzer -v" invokes GCC. At that point ccc-analyzer complains that it can't find the clang invocation in its own output, which it chose not to use clang for, as such: /usr/bin/../libexec/ccc-analyzer -I/home/pjones/devel/github.com/shim/worktree/gnu-efi//lib -I/home/pjones/devel/github.com/shim/worktree/gnu-efi/inc -I/home/pjones/devel/github.com/shim/worktree/gnu-efi/inc/x86_64 -I/home/pjones/devel/github.com/shim/worktree/gnu-efi/inc/protocol -Wno-error=pragmas -mno-red-zone -mno-avx -fpic -Os -Wall -Wextra -Wno-missing-field-initializers -Werror -fshort-wchar -fno-strict-aliasing -ffreestanding -fno-stack-protector -fno-stack-check -nostdinc -isystem /home/pjones/devel/github.com/shim/worktree/gnu-efi/../include/system -isystem /usr/lib/gcc/x86_64-redhat-linux/11/include -DCONFIG_x86_64 -DGNU_EFI_USE_MS_ABI -DGNU_EFI_USE_EXTERNAL_STDARG -maccumulate-outgoing-args --std=c11 -c /home/pjones/devel/github.com/shim/worktree/gnu-efi//lib/smbios.c -o smbios.o could not find clang line make[3]: *** [/home/pjones/devel/github.com/shim/worktree/gnu-efi//lib/../Make.rules:52: smbios.o] Error 1 This patch passes CCC_CC=$(COMPILER) to the gnu-efi sub-make, which forces ccc-analyzer to use $(COMPILER), which is still clang. Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Peter Jones <pjones@redhat.com>
scan-build invoked clang in a way that complains about our SIGNATURE_XX() macro's sizes being used to assign to things that are that size in post-process-pe.c. This patch makes them cast the results to the appropriately sized type. Signed-off-by: Peter Jones <pjones@redhat.com>
scan-build noticed that there's a path where we'll pass some data from the read_image() to e.g. the string functions, but it might be an unassigned pointer on one of the code paths. I don't think you can actually hit it without returning from an error first, but best to initialize these anyway. This patch initializes data to NULL and datasize to 0. Signed-off-by: Peter Jones <pjones@redhat.com>
There are a couple of places where the code we've got right now just uses integers to decode one of our MoK variables. That's bad. This patch replaces those with symbolic names. Signed-off-by: Peter Jones <pjones@redhat.com>
scan-build says info->FileName returned from a successful call to dir->Read() can be NULL. I don't think that would be a compliant implementation, but anything's possible. This patch checks it for NULL-ness before the StrCaseCmp(). Signed-off-by: Peter Jones <pjones@redhat.com>
scan-build noticed that when we split this out, this assignment was no longer in a loop, and so doesn't do anything. Signed-off-by: Peter Jones <pjones@redhat.com>
frozencemetery
approved these changes
May 18, 2022
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.
Coverity sure is a program.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.