Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3697694pxb; Mon, 1 Nov 2021 19:07:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrqzLrOdDFVGiHa2JWr9B5bWBAWMPxIJ1zIfOS/TA7O2b2NNYQVc9pgrScLWuI9qYHR1SH X-Received: by 2002:a05:6e02:1c87:: with SMTP id w7mr10827706ill.244.1635818829300; Mon, 01 Nov 2021 19:07:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635818829; cv=none; d=google.com; s=arc-20160816; b=Qj1f9zJxKxbAZ4qhGJJiTq956VFqreLM069Hm+7Vi7XcqPJMdJAqiEFVONiYzPWjOO WxbNI/sGHWR8C2ThfCdtU7DZT3E1pEEiBVa5okHKbNT6M91TIoKdnAaMZZBei+m1mMBb 8gcZjMS9pmJxpkpvRyTigWxyZ5XgH4q9tQ0pzxduu/7bHSpiNe0ZBDb5nmjXWX4FhpF7 UIYbpXdCWh1JbYEiKe1NYNuIiAnm/gqZH2fQH11rs/nqbsgrGzc3MbnZ4/Tf0M/NT9VM T+xfPSGPjge7qnCssijXWefwnV6l7OKqrAAvdo1YK00M+fBu71kRQZtaJGKsByYV0FD0 Oh/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=wpQnRm9Af5olOGisY9/FYemw2TGMOIqXphqEalQq9Gs=; b=zy5WPz2IUMTJgeudHHLdOe1c1j4oh/HJIycz7HlHRq3kdv8Mg5jyRQKV9bEOS8n5wz ig+qLRqobkDICwDesY9Nk83miVrxy4bgRQAYa5se1hCx2npINxn6x+1BwzWzmv7ATaoN YPXeNSJy5HhLuR9aqdXlQvDQ3HvyVHIvdEuo+9+3ReZnNuOFmmDJuvP8CEBAq6Ku3N7A TGMjqrCArmoNvig3w40iFYmnAEqB83jafb6Pcvgfy4AC5cf3I8kIC8lcGpweiE0B4Cft /RkhE+T9M47wLOV9KFQk+/gOS9ZrfeBpegic0QOFlcHCQy7WPh/DlZk4LoQMFpLb5EJ5 OHgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k13si9815312ilv.35.2021.11.01.19.06.56; Mon, 01 Nov 2021 19:07:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229510AbhKBCGj (ORCPT + 99 others); Mon, 1 Nov 2021 22:06:39 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:13997 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229486AbhKBCGi (ORCPT ); Mon, 1 Nov 2021 22:06:38 -0400 Received: from dggeme762-chm.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4HjtSR4p5dzZch4; Tue, 2 Nov 2021 10:01:59 +0800 (CST) Received: from ubuntu1804.huawei.com (10.67.174.44) by dggeme762-chm.china.huawei.com (10.3.19.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.15; Tue, 2 Nov 2021 10:04:02 +0800 From: Gaosheng Cui To: , CC: , , Subject: [PATCH -next,v2] efi/libstub: arm32: Use "align" for the size alignment Date: Tue, 2 Nov 2021 10:05:45 +0800 Message-ID: <20211102020545.145840-1-cuigaosheng1@huawei.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.44] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggeme762-chm.china.huawei.com (10.3.19.108) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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