From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: sandeen@redhat.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 3/2] misc: ubsan fixes
Date: Fri, 26 Jan 2018 10:14:48 -0800 [thread overview]
Message-ID: <20180126181448.GU9068@magnolia> (raw)
In-Reply-To: <151692412532.32390.5360363880930671862.stgit@magnolia>
From: Darrick J. Wong <darrick.wong@oracle.com>
Fix a few things the undefined behavior sanitizer complained about.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
db/bit.c | 4 ++--
repair/sb.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/db/bit.c b/db/bit.c
index a20b6ba..bf8d80e 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 f40cdea..3dc6538 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;
}
next prev parent reply other threads:[~2018-01-26 18:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-25 23:48 [PATCH 0/2] xfsprogs: 4.15 rollup pt. 3 Darrick J. Wong
2018-01-25 23:48 ` [PATCH 1/2] xfs_db: print transaction reservation type information Darrick J. Wong
2018-01-25 23:48 ` [PATCH 2/2] xfs_db: interpret inode timestamps as signed integers Darrick J. Wong
2018-01-30 16:46 ` Eric Sandeen
2018-01-26 18:14 ` Darrick J. Wong [this message]
2018-01-30 16:47 ` [PATCH 3/2] misc: ubsan fixes Eric Sandeen
2018-01-30 3:38 ` [PATCH 4/2] mkfs: don't crash on dswidth overflow Darrick J. Wong
2018-01-30 3:54 ` Eric Sandeen
2018-01-30 3:38 ` [PATCH 5/2] mkfs: don't call values 'illegal', they're invalid Darrick J. Wong
2018-01-30 3:55 ` Eric Sandeen
2018-01-30 3:39 ` [PATCH 6/2] mkfs: always explain why numeric inputs are invalid Darrick J. Wong
2018-01-30 3:57 ` Eric Sandeen
2018-01-30 4:13 ` [PATCH 7/2] mkfs: more sunit/swidth sanity checking Eric Sandeen
2018-01-30 16:48 ` Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180126181448.GU9068@magnolia \
--to=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox