From: Eric Sandeen <sandeen@sandeen.net>
To: xfs@oss.sgi.com
Subject: [PATCH 4/5] xfs_metadump: Fix unaligned accesses
Date: Fri, 9 Oct 2015 14:53:00 -0500 [thread overview]
Message-ID: <56181B1C.6030508@sandeen.net> (raw)
In-Reply-To: <56181A17.9080503@sandeen.net>
This fixes some unaligned accesses spotted by libubsan in
xfs_metadump.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
db/metadump.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/db/metadump.c b/db/metadump.c
index af96e12..39f893d 100644
--- a/db/metadump.c
+++ b/db/metadump.c
@@ -1872,8 +1872,8 @@ scanfunc_bmap(
xfs_agnumber_t ag;
xfs_agblock_t bno;
- ag = XFS_FSB_TO_AGNO(mp, be64_to_cpu(pp[i]));
- bno = XFS_FSB_TO_AGBNO(mp, be64_to_cpu(pp[i]));
+ ag = XFS_FSB_TO_AGNO(mp, get_unaligned_be64(&pp[i]));
+ bno = XFS_FSB_TO_AGBNO(mp, get_unaligned_be64(&pp[i]));
if (bno == 0 || bno > mp->m_sb.sb_agblocks ||
ag > mp->m_sb.sb_agcount) {
@@ -1938,8 +1938,8 @@ process_btinode(
xfs_agnumber_t ag;
xfs_agblock_t bno;
- ag = XFS_FSB_TO_AGNO(mp, be64_to_cpu(pp[i]));
- bno = XFS_FSB_TO_AGBNO(mp, be64_to_cpu(pp[i]));
+ ag = XFS_FSB_TO_AGNO(mp, get_unaligned_be64(&pp[i]));
+ bno = XFS_FSB_TO_AGBNO(mp, get_unaligned_be64(&pp[i]));
if (bno == 0 || bno > mp->m_sb.sb_agblocks ||
ag > mp->m_sb.sb_agcount) {
--
2.6.1
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2015-10-09 19:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-09 19:48 [PATCH 0/5 V2] fix (mostly) minor nits spotted by gcc sanitization Eric Sandeen
2015-10-09 19:49 ` [PATCH 1/5] libxfs: avoid negative (and full-width) shifts in radix-tree.c Eric Sandeen
2015-10-09 19:51 ` [PATCH 2/5] xfs_repair: fix unaligned accesses Eric Sandeen
2015-10-09 20:08 ` Brian Foster
2015-10-13 0:35 ` Dave Chinner
2015-10-09 19:52 ` [PATCH 3/5] xfs_logprint: fix some " Eric Sandeen
2015-10-09 20:08 ` Brian Foster
2015-10-09 19:53 ` Eric Sandeen [this message]
2015-10-09 20:08 ` [PATCH 4/5] xfs_metadump: Fix " Brian Foster
2015-10-09 19:53 ` [PATCH 5/5] xfs_repair: fix left-shift overflows Eric Sandeen
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=56181B1C.6030508@sandeen.net \
--to=sandeen@sandeen.net \
--cc=xfs@oss.sgi.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox