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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs



[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux