diff options
author | Gao Xiang <hsiangkao@aol.com> | 2019-10-14 19:11:30 +0800 |
---|---|---|
committer | Gao Xiang <hsiangkao@aol.com> | 2019-10-15 23:56:03 +0800 |
commit | 0e91d131dcb21b45b21762c77c6d0377fa16f80d (patch) | |
tree | f6b0f34f4d844324fe39652a8e0dc10ee2ad2d71 /lib/cache.c | |
parent | 561cf9fb45d712e0dd460a03b8cb2b27f658f50b (diff) |
erofs-utils: use cmpsgn(x, y) for standardized large value comparsion
Previously, roundup(bb->buffers.off % EROFS_BLKSIZ, alignsize)
+ incr + extrasize is an unsigned 64bit value and sgn(x) didn't
work properly. Fix it.
Link: https://lore.kernel.org/r/20191015155025.13215-1-hsiangkao@aol.com
Fixes: b0ca535297b6 ("erofs-utils: support 64-bit internal buffer cache")
Reviewed-and-tested-by: Li Guifu <blucerlee@gmail.com>
Signed-off-by: Gao Xiang <hsiangkao@aol.com>
Diffstat (limited to 'lib/cache.c')
-rw-r--r-- | lib/cache.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/cache.c b/lib/cache.c index 41d2d5d..e61b201 100644 --- a/lib/cache.c +++ b/lib/cache.c @@ -80,9 +80,9 @@ static int __erofs_battach(struct erofs_buffer_block *bb, bool dryrun) { const erofs_off_t alignedoffset = roundup(bb->buffers.off, alignsize); - const int oob = sgn(roundup(bb->buffers.off % EROFS_BLKSIZ, - alignsize) + incr + extrasize - - EROFS_BLKSIZ); + const int oob = cmpsgn(roundup(bb->buffers.off % EROFS_BLKSIZ, + alignsize) + incr + extrasize, + EROFS_BLKSIZ); bool tailupdate = false; erofs_blk_t blkaddr; |