Thanks. Yes, this is an issue, and should be fixed. Using SmmTypeIndex and AprioriIndex seems good way for 2nd and 3rd loop. How about use "HandleIndex" for the 1st loop?
Will you generate a patch? Or we can help generate patch. Thank you Yao Jiewen From: Zachary Bobroff [mailto:zacha...@ami.com] Sent: Wednesday, June 03, 2015 3:34 AM To: edk2-devel@lists.sourceforge.net Subject: [edk2] Problem with PiSmmCore Dispatcher.c All, I hope I am proving this issue the right way, please correct me if I am not. I also am not sure if this has been already reported. I have come across a problem in Dispatcher.c within PiSmmCore of MdeModulePkg linked here: https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/PiSmmCore/Dispatcher.c The issue is in function "SmmDriverDispatchHandler" on line 1196. Within this function is a for loop fairly early on line 1235 defined like so: for (Index = 0; Index < HandleCount; Index++) { Then on line 1271 there is a another for loop inside the first for loop defined like so: for (Index = 0; Index < sizeof (mSmmFileTypes)/sizeof (EFI_FV_FILETYPE); Index++) { Then on line 1318 you will find another for loop inside the first for loop (but outside the second for loop) defined like so: for (Index = 0; Index < AprioriEntryCount; Index++) { You will note that all three for loops use the same Index variable defined on line 1218 like so: UINTN Index; The only way I can guess that this has ever worked is that because of the last for loop Index is set back to 0. Also, most people are not using Apriori for SMM drivers at this time. Since this is the case, when it loops back around, it hits the if statement checking if this FV was already processed, if so, it continues to the next one. The same process would complete for any subsequent FVs as well. A proposed fix would be to use an alternate Index variable for each of the other two for loops. Since these are both only used locally they could be defined locally like: for (UINTN SmmTypeIndex = 0; SmmTypeIndex < sizeof (mSmmFileTypes)/sizeof (EFI_FV_FILETYPE); SmmTypeIndex ++) { and for (UINTN AprioriIndex = 0; AprioriIndex < AprioriEntryCount; AprioriIndex ++) { Another minor improvement would be to give the overall Index some better name than just Index for the main loop too. Best Regards, Zach The information contained in this message may be confidential and proprietary to American Megatrends, Inc. This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.
------------------------------------------------------------------------------
_______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel