Fix coverity defects: CID 150943, 150938

CID:150943, Type:Unintentional integer overflow
CID:150938, Type:Explicit null dereferenced

Reviewed-by: Tom Caputi <tcaputi@datto.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: cao.xuewen <cao.xuewen@zte.com.cn>
Closes #5255
This commit is contained in:
cao
2016-10-14 05:30:50 +08:00
committed by Brian Behlendorf
parent 05852b3467
commit 3f93077b02
2 changed files with 6 additions and 4 deletions
+2 -2
View File
@@ -3538,7 +3538,7 @@ dbuf_write_children_ready(zio_t *zio, arc_buf_t *buf, void *vdb)
epbs = dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT;
/* Determine if all our children are holes */
for (i = 0, bp = db->db.db_data; i < 1 << epbs; i++, bp++) {
for (i = 0, bp = db->db.db_data; i < 1ULL << epbs; i++, bp++) {
if (!BP_IS_HOLE(bp))
break;
}
@@ -3547,7 +3547,7 @@ dbuf_write_children_ready(zio_t *zio, arc_buf_t *buf, void *vdb)
* If all the children are holes, then zero them all out so that
* we may get compressed away.
*/
if (i == 1 << epbs) {
if (i == 1ULL << epbs) {
/* didn't find any non-holes */
bzero(db->db.db_data, db->db.db_size);
}