public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Re: [edk2-devel] [PATCH] MdeModulePkg/SmiHandlerProfileInfo: Overflowed Array Index
       [not found] <15F5A1D77088756B.29207@groups.io>
@ 2020-03-26  6:10 ` GuoMinJ
  2020-03-30  1:32   ` Guomin Jiang
  0 siblings, 1 reply; 3+ messages in thread
From: GuoMinJ @ 2020-03-26  6:10 UTC (permalink / raw)
  To: devel@edk2.groups.io, newexplorerj@gmail.com,
	GuoMinJ via Groups.Io
  Cc: jian.j.wang@intel.com, hao.a.wu@intel.com

[-- Attachment #1: Type: text/html, Size: 3856 bytes --]

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

* Re: [edk2-devel] [PATCH] MdeModulePkg/SmiHandlerProfileInfo: Overflowed Array Index
  2020-03-26  6:10 ` [edk2-devel] [PATCH] MdeModulePkg/SmiHandlerProfileInfo: Overflowed Array Index GuoMinJ
@ 2020-03-30  1:32   ` Guomin Jiang
  2020-04-03  3:37     ` Wang, Jian J
  0 siblings, 1 reply; 3+ messages in thread
From: Guomin Jiang @ 2020-03-30  1:32 UTC (permalink / raw)
  To: devel@edk2.groups.io, newexplorerj@gmail.com,
	GuoMinJ via Groups.Io
  Cc: Wang, Jian J, Wu, Hao A

[-- Attachment #1: Type: text/plain, Size: 3555 bytes --]

Hi Jian, Hao,

Could you please help review this change?

Thanks
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of GuoMinJ
Sent: Thursday, March 26, 2020 2:11 PM
To: devel@edk2.groups.io; newexplorerj@gmail.com; GuoMinJ via Groups.Io <newexplorerj=gmail.com@groups.io>
Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/SmiHandlerProfileInfo: Overflowed Array Index

Hi jiang, hao
could you please help verify this change.


-------- Original message --------
From: "GuoMinJ via Groups.Io" <newexplorerj=gmail.com@groups.io<mailto:newexplorerj=gmail.com@groups.io>>
Date: Sat, Feb 22, 2020, 1:19 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: GuoMinJ <newexplorerj@gmail.com<mailto:newexplorerj@gmail.com>>
Subject: [edk2-devel] [PATCH] MdeModulePkg/SmiHandlerProfileInfo: Overflowed Array Index
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2272
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2289
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2290
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2287
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2288

Index should be off-by one than size of array, so when check
array, the max index should less than size of array.

Signed-off-by: GuoMinJ <newexplorerj@gmail.com<mailto:newexplorerj@gmail.com>>
---
.../SmiHandlerProfileInfo/SmiHandlerProfileInfo.c      | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
index 0f7163160b..4f195b16ce 100644
--- a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
+++ b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
@@ -382,7 +382,7 @@ SxTypeToString (
   IN EFI_SLEEP_TYPE  Type
   )
{
-  if (Type >= 0 && Type <= ARRAY_SIZE(mSxTypeString)) {
+  if (Type >= 0 && Type < ARRAY_SIZE(mSxTypeString)) {
     return mSxTypeString[Type];
   } else {
     AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type);
@@ -407,7 +407,7 @@ SxPhaseToString (
   IN EFI_SLEEP_PHASE Phase
   )
{
-  if (Phase >= 0 && Phase <= ARRAY_SIZE(mSxPhaseString)) {
+  if (Phase >= 0 && Phase < ARRAY_SIZE(mSxPhaseString)) {
     return mSxPhaseString[Phase];
   } else {
     AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Phase);
@@ -457,7 +457,7 @@ StandbyButtonPhaseToString (
   IN EFI_STANDBY_BUTTON_PHASE  Phase
   )
{
-  if (Phase >= 0 && Phase <= ARRAY_SIZE(mStandbyButtonPhaseString)) {
+  if (Phase >= 0 && Phase < ARRAY_SIZE(mStandbyButtonPhaseString)) {
     return mStandbyButtonPhaseString[Phase];
   } else {
     AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Phase);
@@ -483,7 +483,7 @@ IoTrapTypeToString (
   IN EFI_SMM_IO_TRAP_DISPATCH_TYPE  Type
   )
{
-  if (Type >= 0 && Type <= ARRAY_SIZE(mIoTrapTypeString)) {
+  if (Type >= 0 && Type < ARRAY_SIZE(mIoTrapTypeString)) {
     return mIoTrapTypeString[Type];
   } else {
     AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type);
@@ -508,7 +508,7 @@ UsbTypeToString (
   IN EFI_USB_SMI_TYPE          Type
   )
{
-  if (Type >= 0 && Type <= ARRAY_SIZE(mUsbTypeString)) {
+  if (Type >= 0 && Type < ARRAY_SIZE(mUsbTypeString)) {
     return mUsbTypeString[Type];
   } else {
     AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type);
--
2.17.1





[-- Attachment #2: Type: text/html, Size: 8526 bytes --]

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

* Re: [edk2-devel] [PATCH] MdeModulePkg/SmiHandlerProfileInfo: Overflowed Array Index
  2020-03-30  1:32   ` Guomin Jiang
@ 2020-04-03  3:37     ` Wang, Jian J
  0 siblings, 0 replies; 3+ messages in thread
From: Wang, Jian J @ 2020-04-03  3:37 UTC (permalink / raw)
  To: Jiang, Guomin, devel@edk2.groups.io, newexplorerj@gmail.com,
	GuoMinJ via Groups.Io
  Cc: Wu, Hao A

[-- Attachment #1: Type: text/plain, Size: 4210 bytes --]

Hi Guomin,

I think you missed one at line 435, function PowerButtonPhaseToString().

Regards,
Jian

From: Jiang, Guomin <guomin.jiang@intel.com>
Sent: Monday, March 30, 2020 9:32 AM
To: devel@edk2.groups.io; newexplorerj@gmail.com; GuoMinJ via Groups.Io <newexplorerj=gmail.com@groups.io>
Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>
Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/SmiHandlerProfileInfo: Overflowed Array Index

Hi Jian, Hao,

Could you please help review this change?

Thanks
From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> [mailto:devel@edk2.groups.io] On Behalf Of GuoMinJ
Sent: Thursday, March 26, 2020 2:11 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; newexplorerj@gmail.com<mailto:newexplorerj@gmail.com>; GuoMinJ via Groups.Io <newexplorerj=gmail.com@groups.io<mailto:newexplorerj=gmail.com@groups.io>>
Cc: Wang, Jian J <jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>>; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/SmiHandlerProfileInfo: Overflowed Array Index

Hi jiang, hao
could you please help verify this change.


-------- Original message --------
From: "GuoMinJ via Groups.Io" <newexplorerj=gmail.com@groups.io<mailto:newexplorerj=gmail.com@groups.io>>
Date: Sat, Feb 22, 2020, 1:19 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: GuoMinJ <newexplorerj@gmail.com<mailto:newexplorerj@gmail.com>>
Subject: [edk2-devel] [PATCH] MdeModulePkg/SmiHandlerProfileInfo: Overflowed Array Index
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2272
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2289
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2290
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2287
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2288

Index should be off-by one than size of array, so when check
array, the max index should less than size of array.

Signed-off-by: GuoMinJ <newexplorerj@gmail.com<mailto:newexplorerj@gmail.com>>
---
.../SmiHandlerProfileInfo/SmiHandlerProfileInfo.c      | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
index 0f7163160b..4f195b16ce 100644
--- a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
+++ b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
@@ -382,7 +382,7 @@ SxTypeToString (
   IN EFI_SLEEP_TYPE  Type
   )
{
-  if (Type >= 0 && Type <= ARRAY_SIZE(mSxTypeString)) {
+  if (Type >= 0 && Type < ARRAY_SIZE(mSxTypeString)) {
     return mSxTypeString[Type];
   } else {
     AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type);
@@ -407,7 +407,7 @@ SxPhaseToString (
   IN EFI_SLEEP_PHASE Phase
   )
{
-  if (Phase >= 0 && Phase <= ARRAY_SIZE(mSxPhaseString)) {
+  if (Phase >= 0 && Phase < ARRAY_SIZE(mSxPhaseString)) {
     return mSxPhaseString[Phase];
   } else {
     AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Phase);
@@ -457,7 +457,7 @@ StandbyButtonPhaseToString (
   IN EFI_STANDBY_BUTTON_PHASE  Phase
   )
{
-  if (Phase >= 0 && Phase <= ARRAY_SIZE(mStandbyButtonPhaseString)) {
+  if (Phase >= 0 && Phase < ARRAY_SIZE(mStandbyButtonPhaseString)) {
     return mStandbyButtonPhaseString[Phase];
   } else {
     AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Phase);
@@ -483,7 +483,7 @@ IoTrapTypeToString (
   IN EFI_SMM_IO_TRAP_DISPATCH_TYPE  Type
   )
{
-  if (Type >= 0 && Type <= ARRAY_SIZE(mIoTrapTypeString)) {
+  if (Type >= 0 && Type < ARRAY_SIZE(mIoTrapTypeString)) {
     return mIoTrapTypeString[Type];
   } else {
     AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type);
@@ -508,7 +508,7 @@ UsbTypeToString (
   IN EFI_USB_SMI_TYPE          Type
   )
{
-  if (Type >= 0 && Type <= ARRAY_SIZE(mUsbTypeString)) {
+  if (Type >= 0 && Type < ARRAY_SIZE(mUsbTypeString)) {
     return mUsbTypeString[Type];
   } else {
     AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type);
--
2.17.1




[-- Attachment #2: Type: text/html, Size: 10964 bytes --]

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

end of thread, other threads:[~2020-04-03  3:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <15F5A1D77088756B.29207@groups.io>
2020-03-26  6:10 ` [edk2-devel] [PATCH] MdeModulePkg/SmiHandlerProfileInfo: Overflowed Array Index GuoMinJ
2020-03-30  1:32   ` Guomin Jiang
2020-04-03  3:37     ` Wang, Jian J

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