]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Fix coverity defects: CID 150943, 150938
authorcao <cao.xuewen@zte.com.cn>
Thu, 13 Oct 2016 21:30:50 +0000 (05:30 +0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 13 Oct 2016 21:30:50 +0000 (14:30 -0700)
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

module/icp/core/kcf_sched.c
module/zfs/dbuf.c

index 7046495f4d67d1e6e7f0f52a7a79313e1471a9ad..3b4cce4b5294a7f4d276f9d0aebf4b8c29c7b8ca 100644 (file)
@@ -1740,8 +1740,10 @@ kcf_last_req(void *last_req_arg, int status)
                ct = (crypto_dual_data_t *)dcrops->dop_ciphertext;
                break;
        }
-       default:
-               break;
+       default: {
+               panic("invalid kcf_op_group_t %d", (int)params->rp_opgrp);
+               return;
+       }
        }
        ct->dd_offset1 = last_req->kr_saveoffset;
        ct->dd_len1 = last_req->kr_savelen;
index 2ec41fb51e95f65af23f398f55f20c61c276dd62..1d8c0518a2bcdb7fc9d37e5401d2781a80e41151 100644 (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);
        }