From nobody Fri Apr 26 14:07:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+50283+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50283+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1573190826; cv=none; d=zoho.com; s=zohoarc; b=R0YzE2GZTdzjACDKg+fqNUCA0u/oOj6udQrSm2Z0ODyK3oknunFXV3DP8FsH78svN3NnP/a2JzJnrlK6wbOs4KM5yNmWPpHCdEsRb6cvvQbEdXPh67IGj/kWfcCFv1gZVzpQmRvt4onLVdRvI95VRt5mI6sU15B//8xbpK14HdE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573190826; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=hVkCwkQp8elickdSJeDJF981P5I0g6edo4AWd9wJl1U=; b=fX+Ykl3xZJtuyQz6jv0hi4oiH8dyZVWaRvhHIHQ+7k6Gu9PZLwraukCE3ZO8Qhcupz7U1JAIuqJm2R5FDJ26afjy+/IbtwHZzjOW2YM0t1lsTv/tr48bxVe9FxBu+nzYTuZ+LwTs8f0xPQTwoDBgfyPojm/qyMHjlkjXZ7Iol58= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50283+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 157319082657826.1509110851149; Thu, 7 Nov 2019 21:27:06 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id Z8v6YY1788612xnztfoOMcJT; Thu, 07 Nov 2019 21:27:06 -0800 X-Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web10.6204.1573190825455333010 for ; Thu, 07 Nov 2019 21:27:05 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Nov 2019 21:27:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,280,1569308400"; d="scan'208";a="206368127" X-Received: from shenglei-dev.ccr.corp.intel.com ([10.239.158.52]) by orsmga006.jf.intel.com with ESMTP; 07 Nov 2019 21:27:03 -0800 From: "Zhang, Shenglei" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu Subject: [edk2-devel] [PATCH] MdeModulePkg/SmiHandlerProfileInfo: Update the ranges of array index Date: Fri, 8 Nov 2019 13:26:59 +0800 Message-Id: <20191108052659.44532-1-shenglei.zhang@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,shenglei.zhang@intel.com X-Gm-Message-State: 4FOwt1IdMwuo9ic6qaL6ceDCx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1573190826; bh=WU9/BNwWErRCJSSnWr7p3eAudYIQGbCJ4NtWxEGTu6k=; h=Cc:Date:From:Reply-To:Subject:To; b=t6wJ91IfOcGWNtI6XHVCZbf4oot4Tt6KSLG+KaD316Rsg+cpSZ5l1NH+WDISL21BaPy Ht17+agOeFOCX9r3496wzCV4rNX5JtiQSzm3HlV4dA/wD/yZ6hk5A9e8Ic7ssUZIgzeug LgGnf+yQCX4ZTOQsuxVANRFHN5EWQW4+kUw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Take the below code as example. if (Type >=3D 0 && Type <=3D ARRAY_SIZE(mSxTypeString)) { return mSxTypeString[Type]; The variable 'Type' used as index should range from 0 ~ ARRAY_SIZE-1. So the if statement should be : if (Type >=3D 0 && Type < ARRAY_SIZE(mSxTypeString)) { And other cases should also follow this rule. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2272 https://bugzilla.tianocore.org/show_bug.cgi?id=3D2287 https://bugzilla.tianocore.org/show_bug.cgi?id=3D2288 https://bugzilla.tianocore.org/show_bug.cgi?id=3D2289 https://bugzilla.tianocore.org/show_bug.cgi?id=3D2290 Cc: Jian J Wang Cc: Hao A Wu Signed-off-by: Shenglei Zhang --- .../SmiHandlerProfileInfo/SmiHandlerProfileInfo.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfi= leInfo.c b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfile= Info.c index 0f7163160b4e..4f195b16ceb0 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 >=3D 0 && Type <=3D ARRAY_SIZE(mSxTypeString)) { + if (Type >=3D 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 >=3D 0 && Phase <=3D ARRAY_SIZE(mSxPhaseString)) { + if (Phase >=3D 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 >=3D 0 && Phase <=3D ARRAY_SIZE(mStandbyButtonPhaseString)) { + if (Phase >=3D 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 >=3D 0 && Type <=3D ARRAY_SIZE(mIoTrapTypeString)) { + if (Type >=3D 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 >=3D 0 && Type <=3D ARRAY_SIZE(mUsbTypeString)) { + if (Type >=3D 0 && Type < ARRAY_SIZE(mUsbTypeString)) { return mUsbTypeString[Type]; } else { AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type); --=20 2.18.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#50283): https://edk2.groups.io/g/devel/message/50283 Mute This Topic: https://groups.io/mt/47268969/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-