* [PATCH v2 0/3] MdeModulePkg: Initialize variables
@ 2019-10-30 14:08 Zhang, Shenglei
2019-10-30 14:08 ` [PATCH v2 1/3] MdeModulePkg/EhciPei: Initialize the variable Map Zhang, Shenglei
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Zhang, Shenglei @ 2019-10-30 14:08 UTC (permalink / raw)
To: devel; +Cc: Hao A Wu, Ray Ni, Dandan Bi, Liming Gao
Initialize the variables before used.
v2: Commit message in all patches has been updated.
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Shenglei Zhang (3):
MdeModulePkg/EhciPei: Initialize the variable Map
MdeModulePkg/UhciPei: Initialize the variable RequestMap
MdeModulePkg/Mem: Initialize the variable MapMemory
MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c | 2 ++
MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c | 2 ++
MdeModulePkg/Core/Dxe/Mem/HeapGuard.c | 2 ++
3 files changed, 6 insertions(+)
--
2.18.0.windows.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/3] MdeModulePkg/EhciPei: Initialize the variable Map
2019-10-30 14:08 [PATCH v2 0/3] MdeModulePkg: Initialize variables Zhang, Shenglei
@ 2019-10-30 14:08 ` Zhang, Shenglei
2019-10-31 1:59 ` Wu, Hao A
2019-10-30 14:08 ` [PATCH v2 2/3] MdeModulePkg/UhciPei: Initialize the variable RequestMap Zhang, Shenglei
2019-10-30 14:08 ` [PATCH v2 3/3] MdeModulePkg/Mem: Initialize the variable MapMemory Zhang, Shenglei
2 siblings, 1 reply; 7+ messages in thread
From: Zhang, Shenglei @ 2019-10-30 14:08 UTC (permalink / raw)
To: devel; +Cc: Hao A Wu, Ray Ni
Map is used but not Initialized.
Map is called by IoMmuMap, in which Mapping(Map) is called by IoMmu->Map.
We can not assume Map is given an initial value at any step.
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c b/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
index 7c6a6a5f9716..995ccd2463d2 100644
--- a/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
+++ b/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
@@ -534,6 +534,8 @@ EhcCreateUrb (
PEI_URB *Urb;
VOID *Map;
+ Map = NULL;
+
Urb = Ehc->Urb;
Urb->Signature = EHC_URB_SIG;
InitializeListHead (&Urb->UrbList);
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] MdeModulePkg/EhciPei: Initialize the variable Map
2019-10-30 14:08 ` [PATCH v2 1/3] MdeModulePkg/EhciPei: Initialize the variable Map Zhang, Shenglei
@ 2019-10-31 1:59 ` Wu, Hao A
0 siblings, 0 replies; 7+ messages in thread
From: Wu, Hao A @ 2019-10-31 1:59 UTC (permalink / raw)
To: Zhang, Shenglei, devel@edk2.groups.io; +Cc: Ni, Ray
> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Wednesday, October 30, 2019 10:08 PM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A; Ni, Ray
> Subject: [PATCH v2 1/3] MdeModulePkg/EhciPei: Initialize the variable Map
>
> Map is used but not Initialized.
> Map is called by IoMmuMap, in which Mapping(Map) is called by IoMmu-
> >Map.
> We can not assume Map is given an initial value at any step.
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Best Regards,
Hao Wu
>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
> ---
> MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
> b/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
> index 7c6a6a5f9716..995ccd2463d2 100644
> --- a/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
> +++ b/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
> @@ -534,6 +534,8 @@ EhcCreateUrb (
> PEI_URB *Urb;
> VOID *Map;
>
> + Map = NULL;
> +
> Urb = Ehc->Urb;
> Urb->Signature = EHC_URB_SIG;
> InitializeListHead (&Urb->UrbList);
> --
> 2.18.0.windows.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/3] MdeModulePkg/UhciPei: Initialize the variable RequestMap
2019-10-30 14:08 [PATCH v2 0/3] MdeModulePkg: Initialize variables Zhang, Shenglei
2019-10-30 14:08 ` [PATCH v2 1/3] MdeModulePkg/EhciPei: Initialize the variable Map Zhang, Shenglei
@ 2019-10-30 14:08 ` Zhang, Shenglei
2019-10-31 1:58 ` Wu, Hao A
2019-10-30 14:08 ` [PATCH v2 3/3] MdeModulePkg/Mem: Initialize the variable MapMemory Zhang, Shenglei
2 siblings, 1 reply; 7+ messages in thread
From: Zhang, Shenglei @ 2019-10-30 14:08 UTC (permalink / raw)
To: devel; +Cc: Hao A Wu, Ray Ni
RequestMap is used but not Initialized.
RequestMap is called by UhciMapUserRequest, in which RequestMap(Map)
is called by IoMmuMap, and is finally called by IoMmu->Map.
We can not assume RequestMap is given an initial value at any step.
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c b/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c
index b897c3f82ce6..a05834da3c4a 100644
--- a/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c
+++ b/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c
@@ -274,6 +274,8 @@ UhcControlTransfer (
PktID = INPUT_PACKET_ID;
+ RequestMap = NULL;
+
if (Request == NULL || TransferResult == NULL) {
return EFI_INVALID_PARAMETER;
}
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/3] MdeModulePkg/UhciPei: Initialize the variable RequestMap
2019-10-30 14:08 ` [PATCH v2 2/3] MdeModulePkg/UhciPei: Initialize the variable RequestMap Zhang, Shenglei
@ 2019-10-31 1:58 ` Wu, Hao A
0 siblings, 0 replies; 7+ messages in thread
From: Wu, Hao A @ 2019-10-31 1:58 UTC (permalink / raw)
To: Zhang, Shenglei, devel@edk2.groups.io; +Cc: Ni, Ray
> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Wednesday, October 30, 2019 10:08 PM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A; Ni, Ray
> Subject: [PATCH v2 2/3] MdeModulePkg/UhciPei: Initialize the variable
> RequestMap
>
> RequestMap is used but not Initialized.
> RequestMap is called by UhciMapUserRequest, in which RequestMap(Map)
> is called by IoMmuMap, and is finally called by IoMmu->Map.
> We can not assume RequestMap is given an initial value at any step.
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Best Regards,
Hao Wu
>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
> ---
> MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c
> b/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c
> index b897c3f82ce6..a05834da3c4a 100644
> --- a/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c
> +++ b/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c
> @@ -274,6 +274,8 @@ UhcControlTransfer (
>
> PktID = INPUT_PACKET_ID;
>
> + RequestMap = NULL;
> +
> if (Request == NULL || TransferResult == NULL) {
> return EFI_INVALID_PARAMETER;
> }
> --
> 2.18.0.windows.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 3/3] MdeModulePkg/Mem: Initialize the variable MapMemory
2019-10-30 14:08 [PATCH v2 0/3] MdeModulePkg: Initialize variables Zhang, Shenglei
2019-10-30 14:08 ` [PATCH v2 1/3] MdeModulePkg/EhciPei: Initialize the variable Map Zhang, Shenglei
2019-10-30 14:08 ` [PATCH v2 2/3] MdeModulePkg/UhciPei: Initialize the variable RequestMap Zhang, Shenglei
@ 2019-10-30 14:08 ` Zhang, Shenglei
2019-11-01 1:59 ` Dandan Bi
2 siblings, 1 reply; 7+ messages in thread
From: Zhang, Shenglei @ 2019-10-30 14:08 UTC (permalink / raw)
To: devel; +Cc: Dandan Bi, Liming Gao
MapMemory is not initialized by FindGuardedMemoryMap
or CoreInternalAllocatePages which calls MapMemory.
So we give a 0 to it.
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
MdeModulePkg/Core/Dxe/Mem/HeapGuard.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c b/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
index 9477b94044ba..b4cb48843fb7 100644
--- a/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
+++ b/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
@@ -225,6 +225,8 @@ FindGuardedMemoryMap (
UINTN BitsToUnitEnd;
EFI_STATUS Status;
+ MapMemory = 0;
+
//
// Adjust current map table depth according to the address to access
//
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 3/3] MdeModulePkg/Mem: Initialize the variable MapMemory
2019-10-30 14:08 ` [PATCH v2 3/3] MdeModulePkg/Mem: Initialize the variable MapMemory Zhang, Shenglei
@ 2019-11-01 1:59 ` Dandan Bi
0 siblings, 0 replies; 7+ messages in thread
From: Dandan Bi @ 2019-11-01 1:59 UTC (permalink / raw)
To: Zhang, Shenglei, devel@edk2.groups.io; +Cc: Gao, Liming
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Thanks,
Dandan
> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Wednesday, October 30, 2019 10:09 PM
> To: devel@edk2.groups.io
> Cc: Bi, Dandan <dandan.bi@intel.com>; Gao, Liming <liming.gao@intel.com>
> Subject: [PATCH v2 3/3] MdeModulePkg/Mem: Initialize the variable
> MapMemory
>
> MapMemory is not initialized by FindGuardedMemoryMap or
> CoreInternalAllocatePages which calls MapMemory.
> So we give a 0 to it.
>
> Cc: Dandan Bi <dandan.bi@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
> ---
> MdeModulePkg/Core/Dxe/Mem/HeapGuard.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
> b/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
> index 9477b94044ba..b4cb48843fb7 100644
> --- a/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
> +++ b/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
> @@ -225,6 +225,8 @@ FindGuardedMemoryMap (
> UINTN BitsToUnitEnd;
> EFI_STATUS Status;
>
> + MapMemory = 0;
> +
> //
> // Adjust current map table depth according to the address to access
> //
> --
> 2.18.0.windows.1
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-11-01 1:59 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-30 14:08 [PATCH v2 0/3] MdeModulePkg: Initialize variables Zhang, Shenglei
2019-10-30 14:08 ` [PATCH v2 1/3] MdeModulePkg/EhciPei: Initialize the variable Map Zhang, Shenglei
2019-10-31 1:59 ` Wu, Hao A
2019-10-30 14:08 ` [PATCH v2 2/3] MdeModulePkg/UhciPei: Initialize the variable RequestMap Zhang, Shenglei
2019-10-31 1:58 ` Wu, Hao A
2019-10-30 14:08 ` [PATCH v2 3/3] MdeModulePkg/Mem: Initialize the variable MapMemory Zhang, Shenglei
2019-11-01 1:59 ` Dandan Bi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox