]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/SnpDxe/Snp.c
NetworkPkg/SnpDxe: Prevent invalid PCI BAR access
[mirror_edk2.git] / NetworkPkg / SnpDxe / Snp.c
index 078b27cf5edd007d46ed5fb4beeebde138478395..69e74132ed704a5dd39d43ac41c9d3fb2c2d161e 100644 (file)
@@ -2,6 +2,7 @@
   Implementation of driver entry point and driver binding protocol.\r
 \r
 Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) Microsoft Corporation.<BR>\r
 SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
@@ -465,8 +466,8 @@ SimpleNetworkDriverStart (
   // the IO BAR.  Save the index of the BAR into the adapter info structure.\r
   // for regular 32bit BARs, 0 is memory mapped, 1 is io mapped\r
   //\r
-  Snp->MemoryBarIndex = 0;\r
-  Snp->IoBarIndex     = 1;\r
+  Snp->MemoryBarIndex = PCI_MAX_BAR;\r
+  Snp->IoBarIndex     = PCI_MAX_BAR;\r
   FoundMemoryBar      = FALSE;\r
   FoundIoBar          = FALSE;\r
   for (BarIndex = 0; BarIndex < PCI_MAX_BAR; BarIndex++) {\r
@@ -653,7 +654,7 @@ SimpleNetworkDriverStart (
     //\r
     Status = gBS->CreateEventEx (\r
                     EVT_NOTIFY_SIGNAL,\r
-                    TPL_NOTIFY,\r
+                    TPL_CALLBACK,\r
                     SnpNotifyExitBootServices,\r
                     Snp,\r
                     &gEfiEventExitBootServicesGuid,\r