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

Misc fixups from scan-build. #477

Merged
merged 7 commits into from
May 18, 2022
Merged

Misc fixups from scan-build. #477

merged 7 commits into from
May 18, 2022

Conversation

vathpela
Copy link
Contributor

No description provided.

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>
@vathpela vathpela marked this pull request as ready for review May 18, 2022 20:12
Copy link
Member

@frozencemetery frozencemetery left a 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.

@vathpela vathpela merged commit a78673b into rhboot:main May 18, 2022
@vathpela vathpela deleted the fixups branch May 18, 2022 20:37
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