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>
#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
}
}
/* 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;
}