[PATCH 1/7] xfs_repair: fix integer handling issues

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

 



From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

When we shift sb_logblocks to the right 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 <darrick.wong@xxxxxxxxxx>
---
 repair/sb.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


diff --git a/repair/sb.c b/repair/sb.c
index ef44e39c..543200f7 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)

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux