OSDN Git Service

xfs: xfs_rtword_t should be unsigned, not signed
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 31 May 2018 16:07:20 +0000 (09:07 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Fri, 1 Jun 2018 16:00:16 +0000 (09:00 -0700)
commit2483113f3d7baa303deac115e6764d9489c8316b
treebd28b6896b62217f3bb3de9434bb14bf27977d6a
parent80660f20252d6f76c9f203874ad7c7a4a8508cf8
xfs: xfs_rtword_t should be unsigned, not signed

xfs_rtword_t is used for bit manipulations in the realtime bitmap file.
Since we're performing bit shifts with this type, we don't want sign
extension and we don't want to be left shifting negative quantities
because that's undefined behavior.

This also shuts up these UBSAN warnings:
UBSAN: Undefined behaviour in fs/xfs/libxfs/xfs_rtbitmap.c:833:48
signed integer overflow:
-2147483648 - 1 cannot be represented in type 'int'

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
fs/xfs/libxfs/xfs_types.h