From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=40.107.0.69; helo=eur02-am5-obe.outbound.protection.outlook.com; envelope-from=supreeth.venkatesh@arm.com; receiver=edk2-devel@lists.01.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00069.outbound.protection.outlook.com [40.107.0.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4C47721164C6B for ; Mon, 15 Oct 2018 06:09:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2mVvtII+IywyzNA/Rcy25t8aVwFjEB4NxE0T1P9snIs=; b=I9JEXoT7G+hzGjcQQ5etzueaZuWRRvHShxjspMnEayJwFCw/9jgzDsumm1TAYglCPzkEFhzuYaHUCfqSe7hvBKKbjHSHvtjQTpvydbJmOUaK5M85YD/1gcvtMEbRlIfNIT1U02xD/A8Au1A1kQMjr+L1BIGBRQQMQFBpkKBF33Y= Received: from AM4PR08MB2788.eurprd08.prod.outlook.com (10.171.191.18) by AM4PR08MB0770.eurprd08.prod.outlook.com (10.164.82.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Mon, 15 Oct 2018 13:09:56 +0000 Received: from AM4PR08MB2788.eurprd08.prod.outlook.com ([fe80::d4b:69c8:51b8:1739]) by AM4PR08MB2788.eurprd08.prod.outlook.com ([fe80::d4b:69c8:51b8:1739%4]) with mapi id 15.20.1228.027; Mon, 15 Oct 2018 13:09:56 +0000 From: Supreeth Venkatesh To: Eric Jin , "edk2-devel@lists.01.org" CC: Jiaxin Wu , Supreeth Venkatesh Thread-Topic: [PATCH] uefi-sct/SctPkg: Fix the Possible numeric underflow Thread-Index: AQHUYxGiLjJ9lw+aVUqKlXebz3fxXqUfQVCAgACysQA= Date: Mon, 15 Oct 2018 13:09:56 +0000 Message-ID: References: <20181013162717.11656-1-eric.jin@intel.com> <878ac949-836a-6fd4-77dc-df28851034b0@arm.com> In-Reply-To: <878ac949-836a-6fd4-77dc-df28851034b0@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 x-ms-exchange-imapappendstamp: AM4PR08MB2788.eurprd08.prod.outlook.com (15.20.1228.020) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Supreeth.Venkatesh@arm.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [217.140.111.135] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM4PR08MB0770; 6:7cxTgldUPxnxTW488Sab4whj4yVZmmLV0WY5kaiJ+2G9iDS+/woWxVeZ/cx9Gi9LgfFe4nMnNF3TVp8Vmc0jYW9h2cxOlaLVdt3uZB7Ha1J2YJl2iQw0YYuuD5iFQUKiZnX0VTyMMZ8htSrZLLYsHDKOoYffAMINILigehs65iQQA7t1V5bcwLy7flQnjRs3bQeXn2UvahnLncIb6u8McoFKxMEOBCxL05JOakiuitRxv3gKA76Hy5Hcr7XLcnnSDDnSuGKb7eZQHz3TjUvxrwGKViuTWqfy2o4Ut518SD+5/LNFd3UB42kU+NBztxhst3BWpjCRTNzAsiOJi+38JbV/TEqoDRNwTSRHrMn05GkFEnK0QnNlzSw16rFt79ngIwMPv6j0rQ3BDnekrzVbPCLrTK0wqk+IkJ/MbnOpk3k7omUeQlSJi+NL/YiUR1twJuBA5R5QhHEcvFGQLNCsMw==; 5:tk9nvqf93oxqxFZy0nVG5sSN4Hn6wAMXibKOhpuHxY4yCGmvGjl1WxAk2GLyQ2IFskeb1CkkhL/gRdAgH/IIdVazEiM60kfLEDOQrU2SUZs6USe2KMvx41UDkpbp9oIozAZxjWXx9YjxtLQU8vBPyCzOfarFo6fKwfVXNr6RZvQ=; 7:JidMBxE6rL9l+EIIqFJH8eij9U1wqcz18X7B7/3wUl8sVkQl9E7okI7FB8u11SYDkQ1Fjl+yoC+9MKURI5XAT+kTsRrPyg2cGsz8o/FdD7VQAq9fbfrYzAu6BDZviGm6yYr5wl+uy/bWgV41+adRbyiJy+UO5puO2MhsVHQ/RR8WOP9BmctSqwn/JLP5JpwXG4FUZ3ePsSI8ldq7dcvEQMgb/Q3J0YaVXeztPiOrBp98nvS6PGXc0JeoUiprZt98 x-ms-office365-filtering-correlation-id: 663d835f-edd8-4bbc-b9d2-08d6329f8137 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM4PR08MB0770; x-ms-traffictypediagnostic: AM4PR08MB0770: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917)(228905959029699)(21748063052155)(28532068793085)(190501279198761)(227612066756510); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991067); SRVR:AM4PR08MB0770; BCL:0; PCL:0; RULEID:; SRVR:AM4PR08MB0770; x-forefront-prvs: 0826B2F01B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(366004)(39860400002)(376002)(136003)(396003)(69234005)(189003)(199004)(40434004)(2501003)(7696005)(44832011)(76176011)(2906002)(7736002)(5250100002)(99286004)(476003)(97736004)(4326008)(6506007)(74316002)(446003)(256004)(71200400001)(71190400001)(25786009)(5024004)(14444005)(229853002)(11346002)(53546011)(3846002)(6116002)(790700001)(486006)(33656002)(6306002)(72206003)(68736007)(54896002)(5660300001)(2900100001)(9686003)(86362001)(236005)(53936002)(110136005)(64126003)(54906003)(58126008)(316002)(26005)(102836004)(6436002)(65826007)(186003)(8676002)(478600001)(81166006)(81156014)(8936002)(14454004)(55016002)(105586002)(6246003)(66066001)(106356001)(65806001)(65956001)(65966003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR08MB0770; H:AM4PR08MB2788.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 8ZaYMVkD0wIAGWviQF+lBzSp+6Yib716GzUUKsqSyLxa2GkdOKDAfge3vPc9/MVLxifk5IYms52qOj7PkmzG54RPPDbemtQ0uBgR9nI8256G2Kmld3UKiJZpd10ulNQNtbFQq51ubbpkyhetTZpWhExxx/1Znj+YiPLFbsTYBMo/1u+YHpzIBbZXjt6ceBnq+6+bNsB4yXyDXwJTFAEB5iFEk/qQ6QPK7IIIbxm10QBBrr5h8deFr8sKBYS7wqoV+UXQ8H27LPam4JSl6FHgW2+HSr6NZ8t1yu1H1PzM0XVUj9O3khfqUotwcAklW2+rqkInlTqccahBA2lGA70DG8p7cYF1z23RfxwHb57SfcM= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 663d835f-edd8-4bbc-b9d2-08d6329f8137 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Oct 2018 13:09:56.7824 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR08MB0770 X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [PATCH] uefi-sct/SctPkg: Fix the Possible numeric underflow X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Oct 2018 13:09:59 -0000 Content-Language: en-US Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 RllJDQoNCk9uIDEwLzE1LzIwMTggMDM6MjAgQU0sIFN1cHJlZXRoIFZlbmthdGVzaCB3cm90ZToN ClJldmlld2VkLWJ5OiBTdXByZWV0aCBWZW5rYXRlc2ggPHN1cHJlZXRoLnZlbmthdGVzaEBhcm0u Y29tPjxtYWlsdG86c3VwcmVldGgudmVua2F0ZXNoQGFybS5jb20+DQoNCg0KT24gMTAvMTMvMjAx OCAwNToyNyBQTSwgRXJpYyBKaW4gd3JvdGU6DQoNClBvc3NpYmxlIG51bWVyaWMgdW5kZXJmbG93 IHdoZW4gY2FsY3VsYXRpbmcgdGhlIHN0YXJ0aW5nIExCQSBmb3IgUmVhZEJsb2Nrc19GdW5jIHRl c3QNCg0KQ2M6IFN1cHJlZXRoIFZlbmthdGVzaCA8c3VwcmVldGgudmVua2F0ZXNoQGFybS5jb20+ PG1haWx0bzpzdXByZWV0aC52ZW5rYXRlc2hAYXJtLmNvbT4NCkNjOiBKaWF4aW4gV3UgPGppYXhp bi53dUBpbnRlbC5jb20+PG1haWx0bzpqaWF4aW4ud3VAaW50ZWwuY29tPg0KQ29udHJpYnV0ZWQt dW5kZXI6IFRpYW5vQ29yZSBDb250cmlidXRpb24gQWdyZWVtZW50IDEuMQ0KU2lnbmVkLW9mZi1i eTogRXJpYyBKaW4gPGVyaWMuamluQGludGVsLmNvbT48bWFpbHRvOmVyaWMuamluQGludGVsLmNv bT4NCi0tLQ0KICAuLi4vUHJvdG9jb2wvQmxvY2tJby9CbGFja0JveFRlc3QvQmxvY2tJb0JCVGVz dEZ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