LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Gaosheng Cui <cuigaosheng1@huawei.com>
To: <ardb@kernel.org>, <cuigaosheng1@huawei.com>
Cc: <linux-efi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<wangweiyang2@huawei.com>
Subject: [PATCH -next,v2] efi/libstub: arm32: Use "align" for the size alignment
Date: Tue, 2 Nov 2021 10:05:45 +0800 [thread overview]
Message-ID: <20211102020545.145840-1-cuigaosheng1@huawei.com> (raw)
We are doing page-based allocations, and both the address
and size must meet alignment constraints, so using "align"
for the size alignment is a better choice.
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
---
drivers/firmware/efi/libstub/randomalloc.c | 2 +-
drivers/firmware/efi/libstub/relocate.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/efi/libstub/randomalloc.c b/drivers/firmware/efi/libstub/randomalloc.c
index 724155b9e10d..7b7159bb035d 100644
--- a/drivers/firmware/efi/libstub/randomalloc.c
+++ b/drivers/firmware/efi/libstub/randomalloc.c
@@ -76,7 +76,7 @@ efi_status_t efi_random_alloc(unsigned long size,
if (align < EFI_ALLOC_ALIGN)
align = EFI_ALLOC_ALIGN;
- size = round_up(size, EFI_ALLOC_ALIGN);
+ size = round_up(size, align);
/* count the suitable slots in each memory map entry */
for (map_offset = 0; map_offset < map_size; map_offset += desc_size) {
diff --git a/drivers/firmware/efi/libstub/relocate.c b/drivers/firmware/efi/libstub/relocate.c
index 8ee9eb2b9039..d6d27e8c23f8 100644
--- a/drivers/firmware/efi/libstub/relocate.c
+++ b/drivers/firmware/efi/libstub/relocate.c
@@ -50,7 +50,7 @@ efi_status_t efi_low_alloc_above(unsigned long size, unsigned long align,
if (align < EFI_ALLOC_ALIGN)
align = EFI_ALLOC_ALIGN;
- size = round_up(size, EFI_ALLOC_ALIGN);
+ size = round_up(size, align);
nr_pages = size / EFI_PAGE_SIZE;
for (i = 0; i < map_size / desc_size; i++) {
efi_memory_desc_t *desc;
--
2.30.0
next reply other threads:[~2021-11-02 2:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-02 2:05 Gaosheng Cui [this message]
2021-11-04 9:26 ` Ard Biesheuvel
2021-11-08 12:48 ` cuigaosheng
2021-11-08 12:56 ` cuigaosheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211102020545.145840-1-cuigaosheng1@huawei.com \
--to=cuigaosheng1@huawei.com \
--cc=ardb@kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wangweiyang2@huawei.com \
--subject='Re: [PATCH -next,v2] efi/libstub: arm32: Use "align" for the size alignment' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).