From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=siyuan.fu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4AB8E202E5302 for ; Tue, 26 Jun 2018 18:18:48 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jun 2018 18:18:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,277,1526367600"; d="scan'208";a="70281414" Received: from sfu5-mobl.ccr.corp.intel.com ([10.239.192.241]) by orsmga002.jf.intel.com with ESMTP; 26 Jun 2018 18:18:47 -0700 From: Fu Siyuan To: edk2-devel@lists.01.org Cc: Ye Ting , Wu Jiaxin Date: Wed, 27 Jun 2018 09:18:41 +0800 Message-Id: <20180627011841.13028-1-siyuan.fu@intel.com> X-Mailer: git-send-email 2.13.0.windows.1 Subject: [Patch] MdeModulePkg: Update IP4 driver to check for NULL pointer before using. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2018 01:18:48 -0000 Cc: Ye Ting Cc: Wu Jiaxin Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan --- MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c index 5a9d828703..6a26143e30 100644 --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c @@ -1048,11 +1048,8 @@ Ip4Groups ( // is decreamented each time an address is removed.. // for (Index = IpInstance->GroupCount; Index > 0 ; Index--) { - Group = 0; - if(IpInstance->Groups != NULL) { - Group = IpInstance->Groups[Index - 1]; - } - + ASSERT (IpInstance->Groups != NULL); + Group = IpInstance->Groups[Index - 1]; if ((GroupAddress == NULL) || EFI_IP4_EQUAL (&Group, GroupAddress)) { if (EFI_ERROR (Ip4LeaveGroup (IpInstance, NTOHL (Group)))) { return EFI_DEVICE_ERROR; -- 2.13.0.windows.1