diff options
author | David Sterba <dsterba@suse.com> | 2017-03-31 18:02:48 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-08-21 17:47:42 +0200 |
commit | 1d1bf92d9dee0aeb14dee38151bcf214443f99d5 (patch) | |
tree | 197e67e5b9ce6f925bb76b156010f5015c7d0b9d /fs/btrfs/scrub.c | |
parent | 7736b0a4313c936dc8ccb87e8acf447e12ae2fd1 (diff) | |
download | linux-stable-1d1bf92d9dee0aeb14dee38151bcf214443f99d5.tar.gz linux-stable-1d1bf92d9dee0aeb14dee38151bcf214443f99d5.tar.bz2 linux-stable-1d1bf92d9dee0aeb14dee38151bcf214443f99d5.zip |
btrfs: scrub: clean up division in scrub_find_csum
Use proper helpers for 64bit division.
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/scrub.c')
-rw-r--r-- | fs/btrfs/scrub.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 99f3a7e9eb61..a1b29d581dca 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -2708,7 +2708,9 @@ static int scrub_find_csum(struct scrub_ctx *sctx, u64 logical, u8 *csum) if (!sum) return 0; - index = ((u32)(logical - sum->bytenr)) / sctx->fs_info->sectorsize; + index = div_u64(logical - sum->bytenr, sctx->fs_info->sectorsize); + ASSERT(index < UINT_MAX); + num_sectors = sum->len / sctx->fs_info->sectorsize; memcpy(csum, sum->sums + index, sctx->csum_size); if (index == num_sectors - 1) { |