* [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix out of bounds array index access
@ 2022-09-09 13:58 Michael Kubacki
2022-09-09 14:24 ` Isaac Oram
[not found] ` <1713375209CF3DF9.32320@groups.io>
0 siblings, 2 replies; 3+ messages in thread
From: Michael Kubacki @ 2022-09-09 13:58 UTC (permalink / raw)
To: devel; +Cc: Chasel Chiu, Nate DeSimone, Isaac Oram, Liming Gao, Eric Dong
From: Michael Kubacki <michael.kubacki@microsoft.com>
The following code accesses array index "6" which is invalid as
the array is of length 6.
DEBUG ((DEBUG_INFO, " %08x %08x %08x %08x %08x %08x",
PciData->Device.Bar[0],
PciData->Device.Bar[1],
PciData->Device.Bar[2],
PciData->Device.Bar[3],
PciData->Device.Bar[4],
PciData->Device.Bar[6] <-- BAD ARRAY INDEX
));
PciData is of type "PCI_TYPE00":
typedef struct {
PCI_DEVICE_INDEPENDENT_REGION Hdr;
PCI_DEVICE_HEADER_TYPE_REGION Device;
} PCI_TYPE00;
"PCI_DEVICE_HEADER_TYPE_REGION":
typedef struct {
UINT32 Bar[6]; <- NOTE: ARRAY LENGTH IS 6
UINT32 CISPtr;
UINT16 SubsystemVendorID;
UINT16 SubsystemID;
UINT32 ExpansionRomBar;
UINT8 CapabilityPtr;
UINT8 Reserved1[3];
UINT32 Reserved2;
UINT8 InterruptLine;
UINT8 InterruptPin;
UINT8 MinGnt;
UINT8 MaxLat;
} PCI_DEVICE_HEADER_TYPE_REGION;
This change fixes the array index value.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
---
Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckPci.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckPci.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckPci.c
index 514003944758..575284ccc727 100644
--- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckPci.c
+++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckPci.c
@@ -75,7 +75,7 @@ DumpPciDevice (
PciData->Device.Bar[2],
PciData->Device.Bar[3],
PciData->Device.Bar[4],
- PciData->Device.Bar[6]
+ PciData->Device.Bar[5]
));
DEBUG ((DEBUG_INFO, " %04x\n",
PciData->Hdr.Command
@@ -256,7 +256,7 @@ TestPointCheckPciResource (
UINT16 MinBus;
UINT16 MaxBus;
BOOLEAN IsEnd;
-
+
DEBUG ((DEBUG_INFO, "==== TestPointCheckPciResource - Enter\n"));
HandleBuf = NULL;
Status = gBS->LocateHandleBuffer (
@@ -338,7 +338,7 @@ TestPointCheckPciResource (
// Device
DumpPciDevice ((UINT8)Bus, (UINT8)Device, (UINT8)Func, &PciData);
}
-
+
//
// If this is not a multi-function device, we can leave the loop
// to deal with the next device.
@@ -360,7 +360,7 @@ TestPointCheckPciResource (
}
}
}
-
+
Done:
if (HandleBuf != NULL) {
FreePool (HandleBuf);
--
2.28.0.windows.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix out of bounds array index access
2022-09-09 13:58 [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix out of bounds array index access Michael Kubacki
@ 2022-09-09 14:24 ` Isaac Oram
[not found] ` <1713375209CF3DF9.32320@groups.io>
1 sibling, 0 replies; 3+ messages in thread
From: Isaac Oram @ 2022-09-09 14:24 UTC (permalink / raw)
To: mikuback@linux.microsoft.com, devel@edk2.groups.io
Cc: Chiu, Chasel, Desimone, Nathaniel L, Gao, Liming, Dong, Eric
Reviewed-by: Isaac Oram <isaac.w.oram@intel.com>
-----Original Message-----
From: mikuback@linux.microsoft.com <mikuback@linux.microsoft.com>
Sent: Friday, September 9, 2022 6:59 AM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Oram, Isaac W <isaac.w.oram@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Dong, Eric <eric.dong@intel.com>
Subject: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix out of bounds array index access
From: Michael Kubacki <michael.kubacki@microsoft.com>
The following code accesses array index "6" which is invalid as the array is of length 6.
DEBUG ((DEBUG_INFO, " %08x %08x %08x %08x %08x %08x",
PciData->Device.Bar[0],
PciData->Device.Bar[1],
PciData->Device.Bar[2],
PciData->Device.Bar[3],
PciData->Device.Bar[4],
PciData->Device.Bar[6] <-- BAD ARRAY INDEX
));
PciData is of type "PCI_TYPE00":
typedef struct {
PCI_DEVICE_INDEPENDENT_REGION Hdr;
PCI_DEVICE_HEADER_TYPE_REGION Device;
} PCI_TYPE00;
"PCI_DEVICE_HEADER_TYPE_REGION":
typedef struct {
UINT32 Bar[6]; <- NOTE: ARRAY LENGTH IS 6
UINT32 CISPtr;
UINT16 SubsystemVendorID;
UINT16 SubsystemID;
UINT32 ExpansionRomBar;
UINT8 CapabilityPtr;
UINT8 Reserved1[3];
UINT32 Reserved2;
UINT8 InterruptLine;
UINT8 InterruptPin;
UINT8 MinGnt;
UINT8 MaxLat;
} PCI_DEVICE_HEADER_TYPE_REGION;
This change fixes the array index value.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
---
Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckPci.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckPci.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckPci.c
index 514003944758..575284ccc727 100644
--- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckPci.c
+++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCh
+++ eckPci.c
@@ -75,7 +75,7 @@ DumpPciDevice (
PciData->Device.Bar[2],
PciData->Device.Bar[3],
PciData->Device.Bar[4],
- PciData->Device.Bar[6]
+ PciData->Device.Bar[5]
));
DEBUG ((DEBUG_INFO, " %04x\n",
PciData->Hdr.Command
@@ -256,7 +256,7 @@ TestPointCheckPciResource (
UINT16 MinBus;
UINT16 MaxBus;
BOOLEAN IsEnd;
-
+
DEBUG ((DEBUG_INFO, "==== TestPointCheckPciResource - Enter\n"));
HandleBuf = NULL;
Status = gBS->LocateHandleBuffer (
@@ -338,7 +338,7 @@ TestPointCheckPciResource (
// Device
DumpPciDevice ((UINT8)Bus, (UINT8)Device, (UINT8)Func, &PciData);
}
-
+
//
// If this is not a multi-function device, we can leave the loop
// to deal with the next device.
@@ -360,7 +360,7 @@ TestPointCheckPciResource (
}
}
}
-
+
Done:
if (HandleBuf != NULL) {
FreePool (HandleBuf);
--
2.28.0.windows.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix out of bounds array index access
[not found] ` <1713375209CF3DF9.32320@groups.io>
@ 2022-09-09 14:45 ` Isaac Oram
0 siblings, 0 replies; 3+ messages in thread
From: Isaac Oram @ 2022-09-09 14:45 UTC (permalink / raw)
To: devel@edk2.groups.io, Oram, Isaac W, mikuback@linux.microsoft.com
Cc: Chiu, Chasel, Desimone, Nathaniel L, Gao, Liming, Dong, Eric
Pushed as 4b2a5f42a9..7f63ab7da9
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Isaac Oram
Sent: Friday, September 9, 2022 7:25 AM
To: mikuback@linux.microsoft.com; devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Dong, Eric <eric.dong@intel.com>
Subject: Re: [edk2-devel] [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix out of bounds array index access
Reviewed-by: Isaac Oram <isaac.w.oram@intel.com>
-----Original Message-----
From: mikuback@linux.microsoft.com <mikuback@linux.microsoft.com>
Sent: Friday, September 9, 2022 6:59 AM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Oram, Isaac W <isaac.w.oram@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Dong, Eric <eric.dong@intel.com>
Subject: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix out of bounds array index access
From: Michael Kubacki <michael.kubacki@microsoft.com>
The following code accesses array index "6" which is invalid as the array is of length 6.
DEBUG ((DEBUG_INFO, " %08x %08x %08x %08x %08x %08x",
PciData->Device.Bar[0],
PciData->Device.Bar[1],
PciData->Device.Bar[2],
PciData->Device.Bar[3],
PciData->Device.Bar[4],
PciData->Device.Bar[6] <-- BAD ARRAY INDEX
));
PciData is of type "PCI_TYPE00":
typedef struct {
PCI_DEVICE_INDEPENDENT_REGION Hdr;
PCI_DEVICE_HEADER_TYPE_REGION Device;
} PCI_TYPE00;
"PCI_DEVICE_HEADER_TYPE_REGION":
typedef struct {
UINT32 Bar[6]; <- NOTE: ARRAY LENGTH IS 6
UINT32 CISPtr;
UINT16 SubsystemVendorID;
UINT16 SubsystemID;
UINT32 ExpansionRomBar;
UINT8 CapabilityPtr;
UINT8 Reserved1[3];
UINT32 Reserved2;
UINT8 InterruptLine;
UINT8 InterruptPin;
UINT8 MinGnt;
UINT8 MaxLat;
} PCI_DEVICE_HEADER_TYPE_REGION;
This change fixes the array index value.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
---
Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckPci.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckPci.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckPci.c
index 514003944758..575284ccc727 100644
--- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckPci.c
+++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCh
+++ eckPci.c
@@ -75,7 +75,7 @@ DumpPciDevice (
PciData->Device.Bar[2],
PciData->Device.Bar[3],
PciData->Device.Bar[4],
- PciData->Device.Bar[6]
+ PciData->Device.Bar[5]
));
DEBUG ((DEBUG_INFO, " %04x\n",
PciData->Hdr.Command
@@ -256,7 +256,7 @@ TestPointCheckPciResource (
UINT16 MinBus;
UINT16 MaxBus;
BOOLEAN IsEnd;
-
+
DEBUG ((DEBUG_INFO, "==== TestPointCheckPciResource - Enter\n"));
HandleBuf = NULL;
Status = gBS->LocateHandleBuffer (
@@ -338,7 +338,7 @@ TestPointCheckPciResource (
// Device
DumpPciDevice ((UINT8)Bus, (UINT8)Device, (UINT8)Func, &PciData);
}
-
+
//
// If this is not a multi-function device, we can leave the loop
// to deal with the next device.
@@ -360,7 +360,7 @@ TestPointCheckPciResource (
}
}
}
-
+
Done:
if (HandleBuf != NULL) {
FreePool (HandleBuf);
--
2.28.0.windows.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-09 14:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-09 13:58 [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix out of bounds array index access Michael Kubacki
2022-09-09 14:24 ` Isaac Oram
[not found] ` <1713375209CF3DF9.32320@groups.io>
2022-09-09 14:45 ` [edk2-devel] " Isaac Oram
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox