summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAtish Patra <atish.patra@wdc.com>2020-06-26 02:45:06 +0300
committerArd Biesheuvel <ardb@kernel.org>2020-07-09 09:45:09 +0300
commit950accbabd4cfa83519fa920f99428bcc131c3c9 (patch)
treed061b7f8c00e18417d62174940cc486decf6c47a /drivers
parentc1aac64ddc01112e137121a43645b96c3633c41b (diff)
downloadlinux-950accbabd4cfa83519fa920f99428bcc131c3c9.tar.xz
efi/libstub: Fix gcc error around __umoddi3 for 32 bit builds
32bit gcc doesn't support modulo operation on 64 bit data. It results in a __umoddi3 error while building EFI for 32 bit. Use bitwise operations instead of modulo operations to fix the issue. Signed-off-by: Atish Patra <atish.patra@wdc.com> Link: https://lore.kernel.org/r/20200625234516.31406-2-atish.patra@wdc.com Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/firmware/efi/libstub/alignedmem.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/firmware/efi/libstub/alignedmem.c b/drivers/firmware/efi/libstub/alignedmem.c
index cc89c4d6196f..1de9878ddd3a 100644
--- a/drivers/firmware/efi/libstub/alignedmem.c
+++ b/drivers/firmware/efi/libstub/alignedmem.c
@@ -44,7 +44,7 @@ efi_status_t efi_allocate_pages_aligned(unsigned long size, unsigned long *addr,
*addr = ALIGN((unsigned long)alloc_addr, align);
if (slack > 0) {
- int l = (alloc_addr % align) / EFI_PAGE_SIZE;
+ int l = (alloc_addr & (align - 1)) / EFI_PAGE_SIZE;
if (l) {
efi_bs_call(free_pages, alloc_addr, slack - l + 1);