public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH EDK2 v1 0/1] NetworkPkg/Ip4Dxe:Null-checking before dereference
@ 2023-01-29  1:14 wenyi,xie
  2023-01-29  1:14 ` [PATCH EDK2 v1 1/1] " wenyi,xie
  0 siblings, 1 reply; 2+ messages in thread
From: wenyi,xie @ 2023-01-29  1:14 UTC (permalink / raw)
  To: devel, maciej.rabeda, siyuan.fu; +Cc: songdongkuang, xiewenyi2

Main Changes :
1.Null-checking first before a pointer is dereferenced.

Wenyi Xie (1):
  NetworkPkg/Ip4Dxe:Null-checking before dereference

 NetworkPkg/Ip4Dxe/Ip4Config2Nv.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

-- 
2.20.1.windows.1


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

* [PATCH EDK2 v1 1/1] NetworkPkg/Ip4Dxe:Null-checking before dereference
  2023-01-29  1:14 [PATCH EDK2 v1 0/1] NetworkPkg/Ip4Dxe:Null-checking before dereference wenyi,xie
@ 2023-01-29  1:14 ` wenyi,xie
  0 siblings, 0 replies; 2+ messages in thread
From: wenyi,xie @ 2023-01-29  1:14 UTC (permalink / raw)
  To: devel, maciej.rabeda, siyuan.fu; +Cc: songdongkuang, xiewenyi2

Null-checking first before a pointer is dereferenced.

Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
---
 NetworkPkg/Ip4Dxe/Ip4Config2Nv.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/NetworkPkg/Ip4Dxe/Ip4Config2Nv.c b/NetworkPkg/Ip4Dxe/Ip4Config2Nv.c
index e0b6a4d4a92f..b96e11bdabba 100644
--- a/NetworkPkg/Ip4Dxe/Ip4Config2Nv.c
+++ b/NetworkPkg/Ip4Dxe/Ip4Config2Nv.c
@@ -397,16 +397,16 @@ Ip4Config2ConvertConfigNvDataToIfrNvData (
   UINTN                           DnsCount;
   EFI_IPv4_ADDRESS                *DnsAddress;
 
+  if ((IfrNvData == NULL) || (Instance == NULL)) {
+    return EFI_INVALID_PARAMETER;
+  }
+
   Status      = EFI_SUCCESS;
   Ip4Config2  = &Instance->Ip4Config2;
   Ip4Info     = NULL;
   DnsAddress  = NULL;
   GatewaySize = sizeof (EFI_IPv4_ADDRESS);
 
-  if ((IfrNvData == NULL) || (Instance == NULL)) {
-    return EFI_INVALID_PARAMETER;
-  }
-
   NET_CHECK_SIGNATURE (Instance, IP4_CONFIG2_INSTANCE_SIGNATURE);
 
   IpSb = IP4_SERVICE_FROM_IP4_CONFIG2_INSTANCE (Instance);
@@ -571,6 +571,10 @@ Ip4Config2ConvertIfrNvDataToConfigNvData (
   UINTN          DataSize;
   EFI_INPUT_KEY  Key;
 
+  if ((Instance == NULL) || (IfrFormNvData == NULL)) {
+    return EFI_INVALID_PARAMETER;
+  }
+
   Status    = EFI_SUCCESS;
   Ip4Cfg2   = &Instance->Ip4Config2;
   Ip4NvData = &Instance->Ip4NvData;
@@ -581,10 +585,6 @@ Ip4Config2ConvertIfrNvDataToConfigNvData (
   TimeoutEvent    = NULL;
   SetAddressEvent = NULL;
 
-  if ((Instance == NULL) || (IfrFormNvData == NULL)) {
-    return EFI_INVALID_PARAMETER;
-  }
-
   if (IfrFormNvData->Configure != TRUE) {
     return EFI_SUCCESS;
   }
-- 
2.20.1.windows.1


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

end of thread, other threads:[~2023-01-29  1:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-29  1:14 [PATCH EDK2 v1 0/1] NetworkPkg/Ip4Dxe:Null-checking before dereference wenyi,xie
2023-01-29  1:14 ` [PATCH EDK2 v1 1/1] " wenyi,xie

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