-
Notifications
You must be signed in to change notification settings - Fork 3k
MdeModulePkg: Fix clang build regressions. #11803
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -795,6 +795,7 @@ CompareNameElementDefault ( | |
|
|
||
| AppendString = NULL; | ||
| NvConfigExist = NULL; | ||
| Status = EFI_OUT_OF_RESOURCES; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't EFI_ABORTED a better choice here? (The failures this is for are not out of resources errors.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hii is a protocol documented in UEFI spec( chapter 34). The spec didn't document to return EFI_ABORTED so this will break protocol consumers and spec complaince.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right that any changes must match the UEFI Spec. Thanks for raising this issue. However I believe this return status is - eventually - not returned by anything up at the level affect by the spec. Actually, the following methods should be marked
|
||
| // | ||
| // Make NvConfigPtr point to the first <NvConfig> with AltConfigHdr in DefaultAltCfgResp. | ||
| // | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,6 +111,8 @@ CreateQuestion ( | |
| NAME_VALUE_NODE *NameValueNode; | ||
| BOOLEAN Find; | ||
|
|
||
| Storage = NULL; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is not used uninitialized. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are wrong here, about this particular line, @khaliid2040: it is not used uninitialized, clang does not complain about it, and you correctly did not change this line in your PR.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I am well aware of the issue, I am attempting to work on integrating CLANG builds into CI, so that these issues do not keep recurring, and I had already fixed this set of issues myself, too. (And had only not already created a PR myself because I initially incorrectly assumed they were old bugs - and being worried about submitting these piecemeal, as I have been.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
You are right. There were alot of issues in my original PR. The reason CLANG complaining about the two variables is because of goto statement which is used early before the two variables are initialized so if goto executed then FreePool is handed to garbage address. And still build fails with the log i provided. Are you sure you are using latest CLANG version. Maybe the issue is specific to clang versions. I am new here and still learning project workflow standards, but i hope i answered your question.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe you're saying that you simply agree with my comment here (and then mentioning other related - but not directly related - issues). Please let me know if not! It it still my belief that these two specific variables that I have marked in these two new comments are not used uninitialized (if you look at the code), and are not warned about by any version of clang (as they should not be; I am using LLVM 21) - so the changes in these two places should not be made. (I think you agree, but it's less clear because you added the other comments.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, i disagree with you and the changes should happen. The variable Storage and BrowserStorage are used uninitialized at the beginning of the function. That was my point, and i told you the reason. Please correct me if i am wrong. Thanks
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, I really wasn't clear whether you disagreed (as your longer comment started with "You are right"!). Please can you link to the line where this particular instance of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I apologies, you were right. I overlooked your question. I didn't look at other changes he made I was wrong, and i agree with you now. Again sorry for that. You were right at both your points. |
||
|
|
||
| Statement = CreateStatement (OpCodeData, FormSet, Form); | ||
| if (Statement == NULL) { | ||
| return NULL; | ||
|
|
@@ -330,6 +332,8 @@ FindStorageInList ( | |
| LIST_ENTRY *Link; | ||
| BROWSER_STORAGE *BrowserStorage; | ||
|
|
||
| BrowserStorage = NULL; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is not used uninitialized. |
||
|
|
||
| Link = GetFirstNode (&gBrowserStorageList); | ||
| while (!IsNull (&gBrowserStorageList, Link)) { | ||
| BrowserStorage = BROWSER_STORAGE_FROM_LINK (Link); | ||
|
|
@@ -430,8 +434,11 @@ CreateStorage ( | |
| EFI_GUID *StorageGuid; | ||
| CHAR8 *StorageName; | ||
|
|
||
| UnicodeString = NULL; | ||
| StorageName = NULL; | ||
| UnicodeString = NULL; | ||
| StorageName = NULL; | ||
| BrowserStorage = NULL; | ||
| Storage = NULL; | ||
|
|
||
| switch (StorageType) { | ||
| case EFI_HII_VARSTORE_BUFFER: | ||
| StorageGuid = (EFI_GUID *)(CHAR8 *)&((EFI_IFR_VARSTORE *)OpCodeData)->Guid; | ||
|
|
@@ -2451,7 +2458,7 @@ ParseOpCodes ( | |
| // | ||
| // Insert to Option list of current Question | ||
| // | ||
| if (ParentStatement != NULL) { | ||
| if (ParentStatement == NULL) { | ||
| break; | ||
| } | ||
|
|
||
|
|
||
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.
I think there are other occurrences of this at https://github.com/tianocore/edk2/pull/11687/files
I count 3 in total. Is it possible to check ?
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.
I went back through the 4 PRs addressing static analysis problems and found some additional problems. Thanks for reporting them @pierregondois
To reverify functionality, I booted Ovmf ia32,x64 and went into setup and checked the functionality of the menus, to the best of my ability, and did not see any additional problems. Thanks!