From patchwork Wed Oct 26 19:04:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 79510 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp227205qge; Wed, 26 Oct 2016 12:06:33 -0700 (PDT) X-Received: by 10.98.20.146 with SMTP id 140mr6908324pfu.51.1477508792946; Wed, 26 Oct 2016 12:06:32 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id n27si4185231pfg.110.2016.10.26.12.06.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Oct 2016 12:06:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id AC3151A1ED6; Wed, 26 Oct 2016 12:05:58 -0700 (PDT) X-Original-To: edk2-devel@ml01.01.org Delivered-To: edk2-devel@ml01.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 18E891A1F20 for ; Wed, 26 Oct 2016 12:05:56 -0700 (PDT) Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A9C7170027; Wed, 26 Oct 2016 19:05:55 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-27.phx2.redhat.com [10.3.116.27]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9QJ5701025834; Wed, 26 Oct 2016 15:05:54 -0400 From: Laszlo Ersek To: edk2-devel-01 Date: Wed, 26 Oct 2016 21:04:42 +0200 Message-Id: <20161026190504.9888-26-lersek@redhat.com> In-Reply-To: <20161026190504.9888-1-lersek@redhat.com> References: <20161026190504.9888-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 26 Oct 2016 19:05:55 +0000 (UTC) Subject: [edk2] [PATCH 25/47] MdeModulePkg/UefiBootManagerLib: rebase to ARRAY_SIZE() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ruiyu Ni , Feng Tian , Star Zeng MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Cc: Feng Tian Cc: Ruiyu Ni Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c | 2 +- MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c | 2 +- MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c | 2 +- MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) -- 2.9.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Ruiyu Ni diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c index f086764f24da..050647d8f186 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c @@ -632,7 +632,7 @@ BmGetBootDescription ( // Firstly get the default boot description // DefaultDescription = NULL; - for (Index = 0; Index < sizeof (mBmBootDescriptionHandlers) / sizeof (mBmBootDescriptionHandlers[0]); Index++) { + for (Index = 0; Index < ARRAY_SIZE (mBmBootDescriptionHandlers); Index++) { DefaultDescription = mBmBootDescriptionHandlers[Index] (Handle); if (DefaultDescription != NULL) { // diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c b/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c index a13917bd0844..43895e10f85b 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c @@ -430,7 +430,7 @@ EfiBootManagerUpdateConsoleVariable ( EFI_DEVICE_PATH_PROTOCOL *NewDevicePath; EFI_DEVICE_PATH_PROTOCOL *TempNewDevicePath; - if (ConsoleType >= sizeof (mConVarName) / sizeof (mConVarName[0])) { + if (ConsoleType >= ARRAY_SIZE (mConVarName)) { return EFI_INVALID_PARAMETER; } diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c b/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c index 55df7e9a5f31..35131a94f61d 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c @@ -680,7 +680,7 @@ BmProcessKeyOption ( KeyShiftStateCount = 0; BmGenerateKeyShiftState (0, KeyOption, EFI_SHIFT_STATE_VALID, KeyShiftStates, &KeyShiftStateCount); - ASSERT (KeyShiftStateCount <= sizeof (KeyShiftStates) / sizeof (KeyShiftStates[0])); + ASSERT (KeyShiftStateCount <= ARRAY_SIZE (KeyShiftStates)); EfiAcquireLock (&mBmHotkeyLock); diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c index 9af98de0afaf..e638e5fc67e6 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c @@ -796,7 +796,7 @@ EfiBootManagerIsValidLoadOptionVariableName ( return FALSE; } - for (Index = 0; Index < sizeof (mBmLoadOptionName) / sizeof (mBmLoadOptionName[0]); Index++) { + for (Index = 0; Index < ARRAY_SIZE (mBmLoadOptionName); Index++) { if ((VariableNameLen - 4 == StrLen (mBmLoadOptionName[Index])) && (StrnCmp (VariableName, mBmLoadOptionName[Index], VariableNameLen - 4) == 0) ) { @@ -804,7 +804,7 @@ EfiBootManagerIsValidLoadOptionVariableName ( } } - if (Index == sizeof (mBmLoadOptionName) / sizeof (mBmLoadOptionName[0])) { + if (Index == ARRAY_SIZE (mBmLoadOptionName)) { return FALSE; }