summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadz <[email protected]>2019-05-29 19:17:25 +0200
committerBrian Behlendorf <[email protected]>2019-05-29 10:17:25 -0700
commitec4afd27f198d93a7bd32a05cb288708ba754ada (patch)
treea60d65f1306a0489a19081643ee6de2ab444f8da
parent46df7e6cc97c5c95acdb54abe8b078d7ed410c64 (diff)
Fix integer overflow in get_next_chunk()
dn->dn_datablksz type is uint32_t and need to be casted to uint64_t to avoid an overflow when the record size is greater than 4 MiB. Reviewed-by: Tom Caputi <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Olivier Mazouffre <[email protected]> Closes #8778 Closes #8797
-rw-r--r--module/zfs/dmu.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c
index 1697a6320..a283b0622 100644
--- a/module/zfs/dmu.c
+++ b/module/zfs/dmu.c
@@ -719,8 +719,8 @@ get_next_chunk(dnode_t *dn, uint64_t *start, uint64_t minimum, uint64_t *l1blks)
uint64_t blks;
uint64_t maxblks = DMU_MAX_ACCESS >> (dn->dn_indblkshift + 1);
/* bytes of data covered by a level-1 indirect block */
- uint64_t iblkrange =
- dn->dn_datablksz * EPB(dn->dn_indblkshift, SPA_BLKPTRSHIFT);
+ uint64_t iblkrange = (uint64_t)dn->dn_datablksz *
+ EPB(dn->dn_indblkshift, SPA_BLKPTRSHIFT);
ASSERT3U(minimum, <=, *start);