[PATCH 4/5] xfs_metadump: Fix unaligned accesses
Brian Foster
bfoster at redhat.com
Fri Oct 9 15:08:31 CDT 2015
On Fri, Oct 09, 2015 at 02:53:00PM -0500, Eric Sandeen wrote:
> This fixes some unaligned accesses spotted by libubsan in
> xfs_metadump.
>
> Signed-off-by: Eric Sandeen <sandeen at redhat.com>
> ---
Looks good:
Reviewed-by: Brian Foster <bfoster at 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 at oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
More information about the xfs
mailing list