diff mbox series

[edk2,1/1] MdeModulePkg/PciBusDxe: Fix small memory leak in FreePciDevice

Message ID 1530631973-5775-1-git-send-email-thomas.palmer@hpe.com
State Accepted
Commit 07eba7069d4c23e9b15caa1e729682a88ddf4ada
Headers show
Series [edk2,1/1] MdeModulePkg/PciBusDxe: Fix small memory leak in FreePciDevice | expand

Commit Message

Palmer, Thomas July 3, 2018, 3:32 p.m. UTC
When cleaning the PciIoDevice, also free the BusNumberRange

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>

---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c | 5 +++++
 1 file changed, 5 insertions(+)

-- 
2.7.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Zeng, Star July 6, 2018, 7:34 a.m. UTC | #1
Hi Thomas,

Basically, I agree with this patch as PciIoDevice->BusNumberRanges equals Configuration from PciResAlloc->StartBusEnumeration, and according to PI spec "Because the size of ACPI resource descriptors is not fixed, StartBusEnumeration() is responsible for allocating memory for the buffer Configuration".

But I hope Ruiyu can double confirm it.
Since Ruiyu is taking leave for some days, could you wait?



Thanks,
Star
-----Original Message-----
From: Thomas Palmer [mailto:thomas.palmer@hpe.com] 

Sent: Tuesday, July 3, 2018 11:33 PM
To: edk2-devel@lists.01.org
Cc: Dong, Eric <eric.dong@intel.com>; Zeng, Star <star.zeng@intel.com>; Ni, Ruiyu <ruiyu.ni@intel.com>; garyli@hpe.com; joseph.shifflett@hpe.com; Thomas Palmer <thomas.palmer@hpe.com>
Subject: [PATCH 1/1] MdeModulePkg/PciBusDxe: Fix small memory leak in FreePciDevice

When cleaning the PciIoDevice, also free the BusNumberRange

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>

---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
index ad7a2337f578..48cf57a24f8f 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
@@ -2,6 +2,7 @@
   Supporting functions implementaion for PCI devices management.
 
 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+(C) Copyright 2018 Hewlett Packard Enterprise Development LP<BR>
 This program and the accompanying materials  are licensed and made available under the terms and conditions of the BSD License  which accompanies this distribution.  The full text of the license may be found at @@ -105,6 +106,10 @@ FreePciDevice (
     FreePool (PciIoDevice->DevicePath);
   }
 
+  if (PciIoDevice->BusNumberRanges != NULL) {
+    FreePool (PciIoDevice->BusNumberRanges);  }
+
   FreePool (PciIoDevice);
 }
 
--
2.7.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Palmer, Thomas July 9, 2018, 8:17 p.m. UTC | #2
I can wait, thanks for the heads up

-----Original Message-----
From: Zeng, Star [mailto:star.zeng@intel.com] 

Sent: Friday, July 6, 2018 2:34 AM
To: Palmer, Thomas <thomas.palmer@hpe.com>; edk2-devel@lists.01.org
Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ruiyu <ruiyu.ni@intel.com>; Li, Gary (HPS SW) <garyli@hpe.com>; Shifflett, Joseph <joseph.shifflett@hpe.com>; Zeng, Star <star.zeng@intel.com>
Subject: RE: [PATCH 1/1] MdeModulePkg/PciBusDxe: Fix small memory leak in FreePciDevice

Hi Thomas,

Basically, I agree with this patch as PciIoDevice->BusNumberRanges equals Configuration from PciResAlloc->StartBusEnumeration, and according to PI spec "Because the size of ACPI resource descriptors is not fixed, StartBusEnumeration() is responsible for allocating memory for the buffer Configuration".

But I hope Ruiyu can double confirm it.
Since Ruiyu is taking leave for some days, could you wait?



Thanks,
Star
-----Original Message-----
From: Thomas Palmer [mailto:thomas.palmer@hpe.com] 

Sent: Tuesday, July 3, 2018 11:33 PM
To: edk2-devel@lists.01.org
Cc: Dong, Eric <eric.dong@intel.com>; Zeng, Star <star.zeng@intel.com>; Ni, Ruiyu <ruiyu.ni@intel.com>; garyli@hpe.com; joseph.shifflett@hpe.com; Thomas Palmer <thomas.palmer@hpe.com>
Subject: [PATCH 1/1] MdeModulePkg/PciBusDxe: Fix small memory leak in FreePciDevice

When cleaning the PciIoDevice, also free the BusNumberRange

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>

---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
index ad7a2337f578..48cf57a24f8f 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
@@ -2,6 +2,7 @@
   Supporting functions implementaion for PCI devices management.
 
 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+(C) Copyright 2018 Hewlett Packard Enterprise Development LP<BR>
 This program and the accompanying materials  are licensed and made available under the terms and conditions of the BSD License  which accompanies this distribution.  The full text of the license may be found at @@ -105,6 +106,10 @@ FreePciDevice (
     FreePool (PciIoDevice->DevicePath);
   }
 
+  if (PciIoDevice->BusNumberRanges != NULL) {
+    FreePool (PciIoDevice->BusNumberRanges);  }
+
   FreePool (PciIoDevice);
 }
 
--
2.7.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ni, Ruiyu July 18, 2018, 4:33 a.m. UTC | #3
On 7/3/2018 11:32 PM, Thomas Palmer wrote:
> When cleaning the PciIoDevice, also free the BusNumberRange

> 

> Contributed-under: TianoCore Contribution Agreement 1.1

> Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>

> ---

>   MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c | 5 +++++

>   1 file changed, 5 insertions(+)

> 

> diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c

> index ad7a2337f578..48cf57a24f8f 100644

> --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c

> +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c

> @@ -2,6 +2,7 @@

>     Supporting functions implementaion for PCI devices management.

>   

>   Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>

> +(C) Copyright 2018 Hewlett Packard Enterprise Development LP<BR>

>   This program and the accompanying materials

>   are licensed and made available under the terms and conditions of the BSD License

>   which accompanies this distribution.  The full text of the license may be found at

> @@ -105,6 +106,10 @@ FreePciDevice (

>       FreePool (PciIoDevice->DevicePath);

>     }

>   

> +  if (PciIoDevice->BusNumberRanges != NULL) {

> +    FreePool (PciIoDevice->BusNumberRanges);

> +  }

> +

>     FreePool (PciIoDevice);

>   }

>   

> 

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>


-- 
Thanks,
Ray
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Zeng, Star July 27, 2018, 1:01 a.m. UTC | #4
Reviewed-by: Star Zeng <star.zeng@intel.com> and pushed the patch at 07eba7069d4c23e9b15caa1e729682a88ddf4ada.


Thanks,
Star
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ni, Ruiyu

Sent: Wednesday, July 18, 2018 12:34 PM
To: Thomas Palmer <thomas.palmer@hpe.com>; edk2-devel@lists.01.org
Cc: Dong, Eric <eric.dong@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: Re: [edk2] [PATCH 1/1] MdeModulePkg/PciBusDxe: Fix small memory leak in FreePciDevice

On 7/3/2018 11:32 PM, Thomas Palmer wrote:
> When cleaning the PciIoDevice, also free the BusNumberRange

> 

> Contributed-under: TianoCore Contribution Agreement 1.1

> Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>

> ---

>   MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c | 5 +++++

>   1 file changed, 5 insertions(+)

> 

> diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c 

> b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c

> index ad7a2337f578..48cf57a24f8f 100644

> --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c

> +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c

> @@ -2,6 +2,7 @@

>     Supporting functions implementaion for PCI devices management.

>   

>   Copyright (c) 2006 - 2018, Intel Corporation. All rights 

> reserved.<BR>

> +(C) Copyright 2018 Hewlett Packard Enterprise Development LP<BR>

>   This program and the accompanying materials

>   are licensed and made available under the terms and conditions of the BSD License

>   which accompanies this distribution.  The full text of the license 

> may be found at @@ -105,6 +106,10 @@ FreePciDevice (

>       FreePool (PciIoDevice->DevicePath);

>     }

>   

> +  if (PciIoDevice->BusNumberRanges != NULL) {

> +    FreePool (PciIoDevice->BusNumberRanges);  }

> +

>     FreePool (PciIoDevice);

>   }

>   

> 

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>


--
Thanks,
Ray
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox series

Patch

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
index ad7a2337f578..48cf57a24f8f 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
@@ -2,6 +2,7 @@ 
   Supporting functions implementaion for PCI devices management.
 
 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+(C) Copyright 2018 Hewlett Packard Enterprise Development LP<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
@@ -105,6 +106,10 @@  FreePciDevice (
     FreePool (PciIoDevice->DevicePath);
   }
 
+  if (PciIoDevice->BusNumberRanges != NULL) {
+    FreePool (PciIoDevice->BusNumberRanges);
+  }
+
   FreePool (PciIoDevice);
 }