* [PATCH] xfs_db: fix unaligned accesses
@ 2016-05-06 20:43 Eric Sandeen
2016-05-06 21:38 ` Bill O'Donnell
0 siblings, 1 reply; 2+ messages in thread
From: Eric Sandeen @ 2016-05-06 20:43 UTC (permalink / raw)
To: xfs-oss, Anatoly Pugachev
Fix 2 unaligned accesses in xfs_db which caused bus errors on
sparc64. Similar treatment was already done in xfs_repair and
xfs_metadump but somehow xfs_db got missed.
Thanks to Anatoly for reminding me that unaligned access is
a thing. ;)
Resolves-oss-bugzilla: #1140
Reported-by: Anatoly Pugachev <matorola@gmail.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/db/check.c b/db/check.c
index c626a5c..0871ed7 100644
--- a/db/check.c
+++ b/db/check.c
@@ -2202,7 +2202,7 @@ process_btinode(
pp = XFS_BMDR_PTR_ADDR(dib, 1, xfs_bmdr_maxrecs(
XFS_DFORK_SIZE(dip, mp, whichfork), 0));
for (i = 0; i < be16_to_cpu(dib->bb_numrecs); i++)
- scan_lbtree(be64_to_cpu(pp[i]),
+ scan_lbtree(get_unaligned_be64(&pp[i]),
be16_to_cpu(dib->bb_level),
scanfunc_bmap, type, id, totd, toti,
nex, blkmapp, 1,
diff --git a/db/frag.c b/db/frag.c
index 3beb416..36bb689 100644
--- a/db/frag.c
+++ b/db/frag.c
@@ -258,8 +258,8 @@ process_btinode(
pp = XFS_BMDR_PTR_ADDR(dib, 1,
xfs_bmdr_maxrecs(XFS_DFORK_SIZE(dip, mp, whichfork), 0));
for (i = 0; i < be16_to_cpu(dib->bb_numrecs); i++)
- scan_lbtree(be64_to_cpu(pp[i]), be16_to_cpu(dib->bb_level),
- scanfunc_bmap, extmapp,
+ scan_lbtree(get_unaligned_be64(&pp[i]),
+ be16_to_cpu(dib->bb_level), scanfunc_bmap, extmapp,
whichfork == XFS_DATA_FORK ? TYP_BMAPBTD : TYP_BMAPBTA);
}
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] xfs_db: fix unaligned accesses
2016-05-06 20:43 [PATCH] xfs_db: fix unaligned accesses Eric Sandeen
@ 2016-05-06 21:38 ` Bill O'Donnell
0 siblings, 0 replies; 2+ messages in thread
From: Bill O'Donnell @ 2016-05-06 21:38 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Anatoly Pugachev, xfs-oss
On Fri, May 06, 2016 at 03:43:53PM -0500, Eric Sandeen wrote:
> Fix 2 unaligned accesses in xfs_db which caused bus errors on
> sparc64. Similar treatment was already done in xfs_repair and
> xfs_metadump but somehow xfs_db got missed.
>
> Thanks to Anatoly for reminding me that unaligned access is
> a thing. ;)
>
> Resolves-oss-bugzilla: #1140
> Reported-by: Anatoly Pugachev <matorola@gmail.com>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
>
> diff --git a/db/check.c b/db/check.c
> index c626a5c..0871ed7 100644
> --- a/db/check.c
> +++ b/db/check.c
> @@ -2202,7 +2202,7 @@ process_btinode(
> pp = XFS_BMDR_PTR_ADDR(dib, 1, xfs_bmdr_maxrecs(
> XFS_DFORK_SIZE(dip, mp, whichfork), 0));
> for (i = 0; i < be16_to_cpu(dib->bb_numrecs); i++)
> - scan_lbtree(be64_to_cpu(pp[i]),
> + scan_lbtree(get_unaligned_be64(&pp[i]),
> be16_to_cpu(dib->bb_level),
> scanfunc_bmap, type, id, totd, toti,
> nex, blkmapp, 1,
> diff --git a/db/frag.c b/db/frag.c
> index 3beb416..36bb689 100644
> --- a/db/frag.c
> +++ b/db/frag.c
> @@ -258,8 +258,8 @@ process_btinode(
> pp = XFS_BMDR_PTR_ADDR(dib, 1,
> xfs_bmdr_maxrecs(XFS_DFORK_SIZE(dip, mp, whichfork), 0));
> for (i = 0; i < be16_to_cpu(dib->bb_numrecs); i++)
> - scan_lbtree(be64_to_cpu(pp[i]), be16_to_cpu(dib->bb_level),
> - scanfunc_bmap, extmapp,
> + scan_lbtree(get_unaligned_be64(&pp[i]),
> + be16_to_cpu(dib->bb_level), scanfunc_bmap, extmapp,
> whichfork == XFS_DATA_FORK ? TYP_BMAPBTD : TYP_BMAPBTA);
> }
>
>
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-06 21:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-06 20:43 [PATCH] xfs_db: fix unaligned accesses Eric Sandeen
2016-05-06 21:38 ` Bill O'Donnell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox