[PATCH] xfs_db: fix unaligned accesses
Bill O'Donnell
billodo at redhat.com
Fri May 6 16:38:18 CDT 2016
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 at gmail.com>
> Signed-off-by: Eric Sandeen <sandeen at redhat.com>
> ---
Reviewed-by: Bill O'Donnell <billodo at 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 at oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
More information about the xfs
mailing list