xfs
[Top] [All Lists]

Re: [PATCH 4/5] xfs_metadump: Fix unaligned accesses

To: Eric Sandeen <sandeen@xxxxxxxxxxx>
Subject: Re: [PATCH 4/5] xfs_metadump: Fix unaligned accesses
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Fri, 9 Oct 2015 16:08:31 -0400
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <56181B1C.6030508@xxxxxxxxxxx>
References: <56181A17.9080503@xxxxxxxxxxx> <56181B1C.6030508@xxxxxxxxxxx>
User-agent: Mutt/1.5.23 (2014-03-12)
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@xxxxxxxxxx>
> ---

Looks good:

Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx>

>  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@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs

<Prev in Thread] Current Thread [Next in Thread>