From: Darrick J. Wong Date: Thu, 31 May 2018 19:09:54 +0000 (-0500) Subject: xfs_repair: fix integer handling issues X-Git-Tag: v4.17.0-rc1~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7931f8613e02fc020d40bb8bc8185e3a9b13f522;p=thirdparty%2Fxfsprogs-dev.git xfs_repair: fix integer handling issues When we shift sb_logblocks to the left we need to ensure that we have enough storage space to shift correctly. Cast logblocks to a 64-bit type so that we don't screw up the check. Coverity-id: 1435810 Signed-off-by: Darrick J. Wong Reviewed-by: Allison Henderson Reviewed-by: Carlos Maiolino Signed-off-by: Eric Sandeen --- diff --git a/repair/sb.c b/repair/sb.c index ef44e39c7..543200f7f 100644 --- a/repair/sb.c +++ b/repair/sb.c @@ -313,7 +313,8 @@ verify_sb_loginfo( if (xfs_sb_version_hascrc(sb) && (sb->sb_logblocks == 0 || sb->sb_logblocks > XFS_MAX_LOG_BLOCKS || - (sb->sb_logblocks << sb->sb_blocklog) > XFS_MAX_LOG_BYTES)) + ((unsigned long long)sb->sb_logblocks << sb->sb_blocklog) > + XFS_MAX_LOG_BYTES)) return false; if (sb->sb_logsunit > 1 && sb->sb_logsunit % sb->sb_blocksize)