public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg XhciPei: Fix dead loop issue in UsbHcFreeMemPool()
@ 2022-08-05 11:43 Zeng, Star
  2022-08-08  1:08 ` Wu, Hao A
  0 siblings, 1 reply; 2+ messages in thread
From: Zeng, Star @ 2022-08-05 11:43 UTC (permalink / raw)
  To: devel; +Cc: Star Zeng, Hao A Wu, Ray Ni, Zhikai Sun

Use Block->Next instead of Pool->Head->Next, otherwise the for loop
will be not able to come out.
It will also match with the UsbHcFreeMemPool() in EhciPei.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhikai Sun <zhikai.sun@intel.com>
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c b/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
index c64b38fcfc89..148425ae844e 100644
--- a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
+++ b/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
@@ -385,7 +385,7 @@ UsbHcFreeMemPool (
   // UsbHcUnlinkMemBlock can't be used to unlink and free the
   // first block.
   //
-  for (Block = Pool->Head->Next; Block != NULL; Block = Pool->Head->Next) {
+  for (Block = Pool->Head->Next; Block != NULL; Block = Block->Next) {
     // UsbHcUnlinkMemBlock (Pool->Head, Block);
     UsbHcFreeMemBlock (Pool, Block);
   }
-- 
2.33.1.windows.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] MdeModulePkg XhciPei: Fix dead loop issue in UsbHcFreeMemPool()
  2022-08-05 11:43 [PATCH] MdeModulePkg XhciPei: Fix dead loop issue in UsbHcFreeMemPool() Zeng, Star
@ 2022-08-08  1:08 ` Wu, Hao A
  0 siblings, 0 replies; 2+ messages in thread
From: Wu, Hao A @ 2022-08-08  1:08 UTC (permalink / raw)
  To: Zeng, Star, devel@edk2.groups.io; +Cc: Ni, Ray, Sun, Zhikai

Thanks Star,

How about removing the comments that mention 'UsbHcUnlinkMemBlock' (3 occurrences, in UsbHcFreeMemPool() and UsbHcFreeMem()) to avoid possible confusion?

Best Regards,
Hao Wu

> -----Original Message-----
> From: Zeng, Star <star.zeng@intel.com>
> Sent: Friday, August 5, 2022 7:44 PM
> To: devel@edk2.groups.io
> Cc: Zeng, Star <star.zeng@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Ni,
> Ray <ray.ni@intel.com>; Sun, Zhikai <zhikai.sun@intel.com>
> Subject: [PATCH] MdeModulePkg XhciPei: Fix dead loop issue in
> UsbHcFreeMemPool()
> 
> Use Block->Next instead of Pool->Head->Next, otherwise the for loop will be
> not able to come out.
> It will also match with the UsbHcFreeMemPool() in EhciPei.
> 
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Zhikai Sun <zhikai.sun@intel.com>
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
> b/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
> index c64b38fcfc89..148425ae844e 100644
> --- a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
> +++ b/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
> @@ -385,7 +385,7 @@ UsbHcFreeMemPool (
>    // UsbHcUnlinkMemBlock can't be used to unlink and free the   // first block.
> //-  for (Block = Pool->Head->Next; Block != NULL; Block = Pool->Head->Next)
> {+  for (Block = Pool->Head->Next; Block != NULL; Block = Block->Next) {     //
> UsbHcUnlinkMemBlock (Pool->Head, Block);     UsbHcFreeMemBlock (Pool,
> Block);   }--
> 2.33.1.windows.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-08  1:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-05 11:43 [PATCH] MdeModulePkg XhciPei: Fix dead loop issue in UsbHcFreeMemPool() Zeng, Star
2022-08-08  1:08 ` Wu, Hao A

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox