aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-02-02 09:32:43 -0600
committerEric Sandeen <sandeen@redhat.com>2018-02-02 09:32:43 -0600
commit25f9772ab25ae1e35869ed71ecea951792e3fa10 (patch)
tree6114dc77e0d3d588daceeb3aec6b0f69f66b985e
parentba795fb147cb7b702dc03df7bf7f1938cb636d8f (diff)
downloadxfsprogs-dev-25f9772ab25ae1e35869ed71ecea951792e3fa10.tar.gz
misc: ubsan fixes
Fix a few things the undefined behavior sanitizer complained about. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
-rw-r--r--db/bit.c4
-rw-r--r--repair/sb.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/db/bit.c b/db/bit.c
index a20b6ba5f5..bf8d80efb1 100644
--- a/db/bit.c
+++ b/db/bit.c
@@ -112,11 +112,11 @@ getbitval(
#if __BYTE_ORDER == LITTLE_ENDIAN
if (i == 0 && signext && nbits < 64)
rval = -1LL << nbits;
- rval |= 1LL << (nbits - i - 1);
+ rval |= 1ULL << (nbits - i - 1);
#else
if ((i == (nbits - 1)) && signext && nbits < 64)
rval |= (-1LL << nbits);
- rval |= 1LL << (nbits - i - 1);
+ rval |= 1ULL << (nbits - i - 1);
#endif
}
}
diff --git a/repair/sb.c b/repair/sb.c
index f40cdeab2d..3dc6538bb4 100644
--- a/repair/sb.c
+++ b/repair/sb.c
@@ -89,11 +89,11 @@ verify_sb_blocksize(xfs_sb_t *sb)
/* check to make sure blocksize is legal 2^N, 9 <= N <= 16 */
if (sb->sb_blocksize == 0)
return XR_BAD_BLOCKSIZE;
- if (sb->sb_blocksize != (1 << sb->sb_blocklog))
- return XR_BAD_BLOCKLOG;
if (sb->sb_blocklog < XFS_MIN_BLOCKSIZE_LOG ||
sb->sb_blocklog > XFS_MAX_BLOCKSIZE_LOG)
return XR_BAD_BLOCKLOG;
+ if (sb->sb_blocksize != (1 << sb->sb_blocklog))
+ return XR_BAD_BLOCKLOG;
return 0;
}