All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Serbinenko <phcoder@gmail.com>
To: grub-devel@gnu.org
Cc: Vladimir Serbinenko <phcoder@gmail.com>
Subject: [PATCH v2 2/7] erofs: Replace 64-bit modulo with bitwise operations
Date: Tue,  3 Sep 2024 20:58:47 +0300	[thread overview]
Message-ID: <20240903175852.27019-2-phcoder@gmail.com> (raw)
In-Reply-To: <20240903175852.27019-1-phcoder@gmail.com>

Otherwise depending on compiler we end up with umoddi3 reference and
failed module dependency resolution

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 grub-core/fs/erofs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/grub-core/fs/erofs.c b/grub-core/fs/erofs.c
index 46cfc2e5c..f2a82e988 100644
--- a/grub-core/fs/erofs.c
+++ b/grub-core/fs/erofs.c
@@ -357,13 +357,13 @@ erofs_map_blocks_flatmode (grub_fshelp_node_t node,
     {
       if (grub_add (erofs_iloc (node), erofs_inode_size (node), &map->m_pa) ||
 	  grub_add (map->m_pa, erofs_inode_xattr_ibody_size (node), &map->m_pa) ||
-	  grub_add (map->m_pa, map->m_la % blocksz, &map->m_pa))
+	  grub_add (map->m_pa, map->m_la & (blocksz - 1), &map->m_pa))
 	return grub_error (GRUB_ERR_OUT_OF_RANGE, "m_pa overflow when handling tailpacking");
       if (grub_sub (file_size, map->m_la, &map->m_plen))
 	return grub_error (GRUB_ERR_OUT_OF_RANGE, "m_plen overflow when handling tailpacking");
 
       /* No overflow as map->m_plen <= UINT64_MAX - blocksz + 1. */
-      if (((map->m_pa % blocksz) + map->m_plen) > blocksz)
+      if (((map->m_pa & (blocksz - 1)) + map->m_plen) > blocksz)
 	return grub_error (GRUB_ERR_BAD_FS,
                            "inline data cross block boundary @ inode %" PRIuGRUB_UINT64_T,
                            node->ino);
-- 
2.39.2


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

  reply	other threads:[~2024-09-03 17:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-03 17:58 [PATCH v2 1/7] configure: Look for .otf fonts Vladimir Serbinenko
2024-09-03 17:58 ` Vladimir Serbinenko [this message]
2024-09-03 17:58 ` [PATCH v2 3/7] xzembed: Silence warning when no BCJ is available Vladimir Serbinenko
2024-09-03 17:58 ` [PATCH v2 4/7] configure: Add -mno-gpopt option Vladimir Serbinenko
2024-09-03 17:58 ` [PATCH v2 5/7] gentpl: Put startup_raw.S into beginning of the image Vladimir Serbinenko
2024-09-03 17:58 ` [PATCH v2 6/7] offsets: Set mod_align to 4 on mips Vladimir Serbinenko
2024-09-03 17:58 ` [PATCH v2 7/7] mkimage: Explicitly move modules to __bss_start Vladimir Serbinenko

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=20240903175852.27019-2-phcoder@gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.