From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.81]) by mx.groups.io with SMTP id smtpd.web11.1415.1579201638616189528 for ; Thu, 16 Jan 2020 11:07:18 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hSMDsQTq; spf=pass (domain: redhat.com, ip: 207.211.31.81, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579201637; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z8of5z1b2ugOo5te7rssR3GZXHzXkbz500tQZuMbmFE=; b=hSMDsQTqDyRxSWZF/P/hB17+KmRqxzFvpriGTfrYe89y5nW46KxU4Gzxi4TI1LEXI6Y6dE EB0s+gU8/D1ILBAfwEcrMIY/D2HYKrzzitGFqDHjJWY/iGU7cQoSGI+bB9ft5otVE/QxTC QhIM84KS4IDWuoeW6w6mO3TdeNnHzNo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-145-oxviG3u1O6CKk_g6rWDlBw-1; Thu, 16 Jan 2020 14:07:13 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D692A800D5E; Thu, 16 Jan 2020 19:07:11 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-120.ams2.redhat.com [10.36.116.120]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C6DB80890; Thu, 16 Jan 2020 19:07:10 +0000 (UTC) From: "Laszlo Ersek" To: edk2-devel-groups-io Cc: Chao Zhang , Jian J Wang , Jiewen Yao Subject: [PATCH 02/11] SecurityPkg/DxeImageVerificationHandler: remove "else" after return/break Date: Thu, 16 Jan 2020 20:06:56 +0100 Message-Id: <20200116190705.18816-3-lersek@redhat.com> In-Reply-To: <20200116190705.18816-1-lersek@redhat.com> References: <20200116190705.18816-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: oxviG3u1O6CKk_g6rWDlBw-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: base64 SW4gdGhlIGNvZGUgc3RydWN0dXJlCgogIGlmIChjb25kaXRpb24pIHsKICAgIC8vCiAgICAvLyBi bG9jazEKICAgIC8vCiAgICByZXR1cm47CiAgfSBlbHNlIHsKICAgIC8vCiAgICAvLyBibG9jazIK ICAgIC8vCiAgfQoKbmVzdGluZyAiYmxvY2syIiBpbiBhbiAiZWxzZSIgYnJhbmNoIGlzIHN1cGVy Zmx1b3VzLCBhbmQgaGFybXMKcmVhZGFiaWxpdHkuIEl0IGNhbiBiZSB0cmFuc2Zvcm1lZCB0bzoK CiAgaWYgKGNvbmRpdGlvbikgewogICAgLy8KICAgIC8vIGJsb2NrMQogICAgLy8KICAgIHJldHVy bjsKICB9CiAgLy8KICAvLyBibG9jazIKICAvLwoKd2l0aCBpZGVudGljYWwgYmVoYXZpb3IsIGFu ZCBpbXByb3ZlZCByZWFkYWJpbGl0eSAobGVzcyBuZXN0aW5nKS4KClRoZSBzYW1lIGFwcGxpZXMg dG8gImJyZWFrIiAoaW5zdGVhZCBvZiAicmV0dXJuIikgaW4gYSBsb29wIGJvZHkuCgpQZXJmb3Jt IHRoZXNlIHRyYW5zZm9ybWF0aW9ucyBvbiBEeGVJbWFnZVZlcmlmaWNhdGlvbkhhbmRsZXIoKS4K ClRoaXMgcGF0Y2ggaXMgYSBuby1vcCBmb3IgYmVoYXZpb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OSArMTU1NiwzNTAgQEAgRUZJQVBJCiBEeGVJbWFn ZVZlcmlmaWNhdGlvbkhhbmRsZXIgKA0KICAgSU4gIFVJTlQzMiAgICAgICAgICAgICAgICAgICAg ICAgICAgIEF1dGhlbnRpY2F0aW9uU3RhdHVzLA0KICAgSU4gIENPTlNUIEVGSV9ERVZJQ0VfUEFU SF9QUk9UT0NPTCAgICpGaWxlLA0KICAgSU4gIFZPSUQgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICpGaWxlQnVmZmVyLA0KICAgSU4gIFVJTlROICAgICAgICAgICAgICAgICAgICAgICAgICAg IEZpbGVTaXplLA0KICAgSU4gIEJPT0xFQU4gICAgICAgICAgICAgICAgICAgICAgICAgIEJvb3RQ b2xpY3kNCiAgICkNCiB7DQogICBFRklfU1RBVFVTICAgICAgICAgICAgICAgICAgICAgICAgICAg U3RhdHVzOw0KICAgRUZJX0lNQUdFX0RPU19IRUFERVIgICAgICAgICAgICAgICAgICpEb3NIZHI7 DQogICBCT09MRUFOICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSXNWZXJpZmllZDsNCiAg IEVGSV9TSUdOQVRVUkVfTElTVCAgICAgICAgICAgICAgICAgICAqU2lnbmF0dXJlTGlzdDsNCiAg IFVJTlROICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTaWduYXR1cmVMaXN0U2l6ZTsN CiAgIEVGSV9TSUdOQVRVUkVfREFUQSAgICAgICAgICAgICAgICAgICAqU2lnbmF0dXJlOw0KICAg RUZJX0lNQUdFX0VYRUNVVElPTl9BQ1RJT04gICAgICAgICAgIEFjdGlvbjsNCiAgIFdJTl9DRVJU SUZJQ0FURSAgICAgICAgICAgICAgICAgICAgICAqV2luQ2VydGlmaWNhdGU7DQogICBVSU5UMzIg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUG9saWN5Ow0KICAgVUlOVDggICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICpTZWN1cmVCb290Ow0KICAgUEVfQ09GRl9MT0FERVJfSU1B R0VfQ09OVEVYVCAgICAgICAgIEltYWdlQ29udGV4dDsNCiAgIFVJTlQzMiAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICBOdW1iZXJPZlJ2YUFuZFNpemVzOw0KICAgV0lOX0NFUlRJRklDQVRF X0VGSV9QS0NTICAgICAgICAgICAgICpQa2NzQ2VydERhdGE7DQogICBXSU5fQ0VSVElGSUNBVEVf VUVGSV9HVUlEICAgICAgICAgICAgKldpbkNlcnRVZWZpR3VpZDsNCiAgIFVJTlQ4ICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAqQXV0aERhdGE7DQogICBVSU5UTiAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgQXV0aERhdGFTaXplOw0KICAgRUZJX0lNQUdFX0RBVEFfRElSRUNU T1JZICAgICAgICAgICAgICpTZWNEYXRhRGlyOw0KICAgVUlOVDMyICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIE9mZlNldDsNCiAgIENIQVIxNiAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAqTmFtZVN0cjsNCiANCiAgIFNpZ25hdHVyZUxpc3QgICAgID0gTlVMTDsNCiAgIFNpZ25h dHVyZUxpc3RTaXplID0gMDsNCiAgIFdpbkNlcnRpZmljYXRlICAgID0gTlVMTDsNCiAgIFNlY0Rh dGFEaXIgICAgICAgID0gTlVMTDsNCiAgIFBrY3NDZXJ0RGF0YSAgICAgID0gTlVMTDsNCiAgIEFj dGlvbiAgICAgICAgICAgID0gRUZJX0lNQUdFX0VYRUNVVElPTl9BVVRIX1VOVEVTVEVEOw0KICAg U3RhdHVzICAgICAgICAgICAgPSBFRklfQUNDRVNTX0RFTklFRDsNCiAgIElzVmVyaWZpZWQgICAg ICAgID0gRkFMU0U7DQogDQogDQogICAvLw0KICAgLy8gQ2hlY2sgdGhlIGltYWdlIHR5cGUgYW5k IGdldCBwb2xpY3kgc2V0dGluZy4NCiAgIC8vDQogICBzd2l0Y2ggKEdld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