[edk2-devel] [edk2-platforms Patch 17/28] Vlvt2TbltDevicePkg: Fix NULL pointer access in SmbiosMiscDxe

Michael D Kinney posted 28 patches 6 years, 7 months ago
[edk2-devel] [edk2-platforms Patch 17/28] Vlvt2TbltDevicePkg: Fix NULL pointer access in SmbiosMiscDxe
Posted by Michael D Kinney 6 years, 7 months ago
Handle case where no Simple Network Protocols are found.

Cc: Zailiang Sun <zailiang.sun@intel.com>
Cc: Yi Qian <yi.qian@intel.com>
Cc: Gary Lin <glin@suse.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 .../MiscBaseBoardManufacturerFunction.c            | 14 +++++++++-----
 .../SmBiosMiscDxe/MiscSystemManufacturerFunction.c | 14 +++++++++-----
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerFunction.c
index 4e02486853..8eddc5c2a6 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerFunction.c
+++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerFunction.c
@@ -130,11 +130,15 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer)
   //
   //Get the MAC string
   //
-  Status = NetLibGetMacString (
-             *Handles,
-             NULL,
-             &MacStr
-             );
+  if (Handles == NULL) {
+    Status = EFI_NOT_FOUND;
+  } else {
+    Status = NetLibGetMacString (
+               *Handles,
+               NULL,
+               &MacStr
+               );
+  }
   if (EFI_ERROR (Status)) {	
     MacStr = L"000000000000";
   }
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerFunction.c
index da660cb3a8..b18dbd6ae2 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerFunction.c
+++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerFunction.c
@@ -212,11 +212,15 @@ AddSmbiosManuCallback (
   //
   //Get the MAC string
   //
-  Status = NetLibGetMacString (
-             *Handles,
-             NULL,
-             &MacStr
-             );
+  if (Handles == NULL) {
+    Status = EFI_NOT_FOUND;
+  } else {
+    Status = NetLibGetMacString (
+               *Handles,
+               NULL,
+               &MacStr
+               );
+  }
   if (EFI_ERROR (Status)) {
     MacStr = L"000000000000";
   }
-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43508): https://edk2.groups.io/g/devel/message/43508
Mute This Topic: https://groups.io/mt/32419741/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [edk2-platforms Patch 17/28] Vlvt2TbltDevicePkg: Fix NULL pointer access in SmbiosMiscDxe
Posted by Sun, Zailiang 6 years, 7 months ago
Reviewed-By: Zailiang Sun <zailiang.sun@intel.com>

> -----Original Message-----
> From: Kinney, Michael D
> Sent: Thursday, July 11, 2019 3:05 AM
> To: devel@edk2.groups.io
> Cc: Sun, Zailiang <zailiang.sun@intel.com>; Qian, Yi <yi.qian@intel.com>;
> Gary Lin <glin@suse.com>
> Subject: [edk2-platforms Patch 17/28] Vlvt2TbltDevicePkg: Fix NULL pointer
> access in SmbiosMiscDxe
> 
> Handle case where no Simple Network Protocols are found.
> 
> Cc: Zailiang Sun <zailiang.sun@intel.com>
> Cc: Yi Qian <yi.qian@intel.com>
> Cc: Gary Lin <glin@suse.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>  .../MiscBaseBoardManufacturerFunction.c            | 14 +++++++++-----
>  .../SmBiosMiscDxe/MiscSystemManufacturerFunction.c | 14 +++++++++----
> -
>  2 files changed, 18 insertions(+), 10 deletions(-)
> 
> diff --git
> a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufa
> cturerFunction.c
> b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufa
> cturerFunction.c
> index 4e02486853..8eddc5c2a6 100644
> ---
> a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufa
> cturerFunction.c
> +++
> b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufa
> cturerFunction.c
> @@ -130,11 +130,15 @@
> MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer)
>    //
>    //Get the MAC string
>    //
> -  Status = NetLibGetMacString (
> -             *Handles,
> -             NULL,
> -             &MacStr
> -             );
> +  if (Handles == NULL) {
> +    Status = EFI_NOT_FOUND;
> +  } else {
> +    Status = NetLibGetMacString (
> +               *Handles,
> +               NULL,
> +               &MacStr
> +               );
> +  }
>    if (EFI_ERROR (Status)) {
>      MacStr = L"000000000000";
>    }
> diff --git
> a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufactu
> rerFunction.c
> b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufactu
> rerFunction.c
> index da660cb3a8..b18dbd6ae2 100644
> ---
> a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufactu
> rerFunction.c
> +++
> b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufactu
> rerFunction.c
> @@ -212,11 +212,15 @@ AddSmbiosManuCallback (
>    //
>    //Get the MAC string
>    //
> -  Status = NetLibGetMacString (
> -             *Handles,
> -             NULL,
> -             &MacStr
> -             );
> +  if (Handles == NULL) {
> +    Status = EFI_NOT_FOUND;
> +  } else {
> +    Status = NetLibGetMacString (
> +               *Handles,
> +               NULL,
> +               &MacStr
> +               );
> +  }
>    if (EFI_ERROR (Status)) {
>      MacStr = L"000000000000";
>    }
> --
> 2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43566): https://edk2.groups.io/g/devel/message/43566
Mute This Topic: https://groups.io/mt/32419741/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-