]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: fix sign handling problem in xfs_bmbt_diff_two_keys
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 27 Aug 2019 00:06:02 +0000 (17:06 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Wed, 28 Aug 2019 15:31:01 +0000 (08:31 -0700)
commited24f7f361bb9e5171d523dfcdf3f07adb361ba0
tree0aa5387e6c142b5fd320f9cfe4966bc733545fed
parentbe6896540191950914321c065d7c961d26a96a83
xfs: fix sign handling problem in xfs_bmbt_diff_two_keys

In xfs_bmbt_diff_two_keys, we perform a signed int64_t subtraction with
two unsigned 64-bit quantities.  If the second quantity is actually the
"maximum" key (all ones) as used in _query_all, the subtraction
effectively becomes addition of two positive numbers and the function
returns incorrect results.  Fix this with explicit comparisons of the
unsigned values.  Nobody needs this now, but the online repair patches
will need this to work properly.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/libxfs/xfs_bmap_btree.c