Skip to content

Commit 950accb

Browse files
atishp04ardbiesheuvel
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent c1aac64 commit 950accb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/firmware/efi/libstub/alignedmem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ efi_status_t efi_allocate_pages_aligned(unsigned long size, unsigned long *addr,
4444
*addr = ALIGN((unsigned long)alloc_addr, align);
4545

4646
if (slack > 0) {
47-
int l = (alloc_addr % align) / EFI_PAGE_SIZE;
47+
int l = (alloc_addr & (align - 1)) / EFI_PAGE_SIZE;
4848

4949
if (l) {
5050
efi_bs_call(free_pages, alloc_addr, slack - l + 1);

0 commit comments

Comments
 (0)