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

MdeModulePkg: address VarCheckHiiLib build failures #10758

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

leiflindholm
Copy link
Member

While attempting to build MdeModulePkg.dsc for other reasons, I was blocked by a compiler error:

/work/git/edk2/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiLibStandaloneMm.c:78:7: error: variable 'Status' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
   78 |   if (DispatchHandle != NULL) {
      |       ^~~~~~~~~~~~~~~~~~~~~~
/work/git/edk2/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiLibStandaloneMm.c:82:18: note: uninitialized use occurs here
   82 |   if (EFI_ERROR (Status)) {
      |                  ^~~~~~

Then when I looked at the code, I noticed the documented return values are not what the function returns.

I do think there are additional issues with this code; CommBuffer and CommBufferSize are documented as needing to be not-NULL, but are declared as OPTIONAL.

The doxygen comment for VarCheckHiiLibReceiveHiiBinHandler says that
EFI_INVALID_PARAMETER should be returned if either of CommBuffer or
CommBufferSize is NULL, but the test results in an early return of
EFI_SUCCESS.

Update the code to match the documentation.

Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
Building VarCheckHiiLib fails on my clang 19.1.6 setup with the error
 variable 'Status' is used uninitialized whenever 'if' condition is false
due to the DispatchHandle != NULL test.

Calling this function with a NULL handle makes no sense, so move the test
to the function entry and return failure if appropriate.

Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
@leiflindholm
Copy link
Member Author

Pinging additional reviewers of #5938: @jiaxinwu @dandanbi.

@leiflindholm
Copy link
Member Author

Oh, and @xieyuanh.

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.

1 participant