diff options
Diffstat (limited to 'module/os/linux/zfs')
-rw-r--r-- | module/os/linux/zfs/qat_crypt.c | 10 | ||||
-rw-r--r-- | module/os/linux/zfs/zfs_acl.c | 24 | ||||
-rw-r--r-- | module/os/linux/zfs/zfs_dir.c | 4 | ||||
-rw-r--r-- | module/os/linux/zfs/zfs_uio.c | 10 | ||||
-rw-r--r-- | module/os/linux/zfs/zfs_vfsops.c | 2 | ||||
-rw-r--r-- | module/os/linux/zfs/zfs_znode.c | 6 | ||||
-rw-r--r-- | module/os/linux/zfs/zio_crypt.c | 132 |
7 files changed, 95 insertions, 93 deletions
diff --git a/module/os/linux/zfs/qat_crypt.c b/module/os/linux/zfs/qat_crypt.c index 4771b2f3b..18b6e38d1 100644 --- a/module/os/linux/zfs/qat_crypt.c +++ b/module/os/linux/zfs/qat_crypt.c @@ -367,7 +367,7 @@ qat_crypt(qat_encrypt_dir_t dir, uint8_t *src_buf, uint8_t *dst_buf, aad_len); if (status != CPA_STATUS_SUCCESS) goto fail; - bcopy(aad_buf, op_data.pAdditionalAuthData, aad_len); + memcpy(op_data.pAdditionalAuthData, aad_buf, aad_len); } bytes_left = enc_len; @@ -413,10 +413,10 @@ qat_crypt(qat_encrypt_dir_t dir, uint8_t *src_buf, uint8_t *dst_buf, op_data.messageLenToHashInBytes = 0; op_data.messageLenToCipherInBytes = enc_len; op_data.ivLenInBytes = ZIO_DATA_IV_LEN; - bcopy(iv_buf, op_data.pIv, ZIO_DATA_IV_LEN); + memcpy(op_data.pIv, iv_buf, ZIO_DATA_IV_LEN); /* if dir is QAT_DECRYPT, copy digest_buf to pDigestResult */ if (dir == QAT_DECRYPT) - bcopy(digest_buf, op_data.pDigestResult, ZIO_DATA_MAC_LEN); + memcpy(op_data.pDigestResult, digest_buf, ZIO_DATA_MAC_LEN); cb.verify_result = CPA_FALSE; init_completion(&cb.complete); @@ -435,7 +435,7 @@ qat_crypt(qat_encrypt_dir_t dir, uint8_t *src_buf, uint8_t *dst_buf, if (dir == QAT_ENCRYPT) { /* if dir is QAT_ENCRYPT, save pDigestResult to digest_buf */ - bcopy(op_data.pDigestResult, digest_buf, ZIO_DATA_MAC_LEN); + memcpy(digest_buf, op_data.pDigestResult, ZIO_DATA_MAC_LEN); QAT_STAT_INCR(encrypt_total_out_bytes, enc_len); } else { QAT_STAT_INCR(decrypt_total_out_bytes, enc_len); @@ -557,7 +557,7 @@ qat_checksum(uint64_t cksum, uint8_t *buf, uint64_t size, zio_cksum_t *zcp) goto fail; } - bcopy(digest_buffer, zcp, sizeof (zio_cksum_t)); + memcpy(zcp, digest_buffer, sizeof (zio_cksum_t)); fail: if (status != CPA_STATUS_SUCCESS) diff --git a/module/os/linux/zfs/zfs_acl.c b/module/os/linux/zfs/zfs_acl.c index 1859ecd99..351e4dad7 100644 --- a/module/os/linux/zfs/zfs_acl.c +++ b/module/os/linux/zfs/zfs_acl.c @@ -687,10 +687,10 @@ zfs_copy_ace_2_fuid(zfsvfs_t *zfsvfs, umode_t obj_mode, zfs_acl_t *aclp, zobjacep = (zfs_object_ace_t *)aceptr; aceobjp = (ace_object_t *)acep; - bcopy(aceobjp->a_obj_type, zobjacep->z_object_type, + memcpy(zobjacep->z_object_type, aceobjp->a_obj_type, sizeof (aceobjp->a_obj_type)); - bcopy(aceobjp->a_inherit_obj_type, - zobjacep->z_inherit_type, + memcpy(zobjacep->z_inherit_type, + aceobjp->a_inherit_obj_type, sizeof (aceobjp->a_inherit_obj_type)); acep = (ace_t *)((caddr_t)acep + sizeof (ace_object_t)); break; @@ -737,11 +737,11 @@ zfs_copy_fuid_2_ace(zfsvfs_t *zfsvfs, zfs_acl_t *aclp, cred_t *cr, } zobjacep = (zfs_object_ace_t *)zacep; objacep = (ace_object_t *)acep; - bcopy(zobjacep->z_object_type, - objacep->a_obj_type, + memcpy(objacep->a_obj_type, + zobjacep->z_object_type, sizeof (zobjacep->z_object_type)); - bcopy(zobjacep->z_inherit_type, - objacep->a_inherit_obj_type, + memcpy(objacep->a_inherit_obj_type, + zobjacep->z_inherit_type, sizeof (zobjacep->z_inherit_type)); ace_size = sizeof (ace_object_t); break; @@ -1102,7 +1102,7 @@ zfs_acl_node_read(struct znode *zp, boolean_t have_lock, zfs_acl_t **aclpp, znode_acl.z_acl_extern_obj, 0, aclnode->z_size, aclnode->z_acldata, DMU_READ_PREFETCH); } else { - bcopy(znode_acl.z_ace_data, aclnode->z_acldata, + memcpy(aclnode->z_acldata, znode_acl.z_ace_data, aclnode->z_size); } } else { @@ -1447,7 +1447,7 @@ zfs_aclset_common(znode_t *zp, zfs_acl_t *aclp, cred_t *cr, dmu_tx_t *tx) aclnode = list_next(&aclp->z_acl, aclnode)) { if (aclnode->z_ace_count == 0) continue; - bcopy(aclnode->z_acldata, start, + memcpy(start, aclnode->z_acldata, aclnode->z_size); start = (caddr_t)start + aclnode->z_size; } @@ -1727,7 +1727,7 @@ zfs_acl_inherit(zfsvfs_t *zfsvfs, umode_t va_mode, zfs_acl_t *paclp, if ((data1sz = paclp->z_ops->ace_data(pacep, &data1)) != 0) { VERIFY((data2sz = aclp->z_ops->ace_data(acep, &data2)) == data1sz); - bcopy(data1, data2, data2sz); + memcpy(data2, data1, data2sz); } aclp->z_acl_count++; @@ -1791,7 +1791,7 @@ zfs_acl_ids_create(znode_t *dzp, int flag, vattr_t *vap, cred_t *cr, boolean_t trim = B_FALSE; boolean_t inherited = B_FALSE; - bzero(acl_ids, sizeof (zfs_acl_ids_t)); + memset(acl_ids, 0, sizeof (zfs_acl_ids_t)); acl_ids->z_mode = vap->va_mode; if (vsecp) @@ -2016,7 +2016,7 @@ zfs_getacl(znode_t *zp, vsecattr_t *vsecp, boolean_t skipaclchk, cred_t *cr) for (aclnode = list_head(&aclp->z_acl); aclnode; aclnode = list_next(&aclp->z_acl, aclnode)) { - bcopy(aclnode->z_acldata, start, + memcpy(start, aclnode->z_acldata, aclnode->z_size); start = (caddr_t)start + aclnode->z_size; } diff --git a/module/os/linux/zfs/zfs_dir.c b/module/os/linux/zfs/zfs_dir.c index 82b32d1cc..c5b3b5ce7 100644 --- a/module/os/linux/zfs/zfs_dir.c +++ b/module/os/linux/zfs/zfs_dir.c @@ -297,7 +297,7 @@ zfs_dirent_lock(zfs_dirlock_t **dlpp, znode_t *dzp, char *name, */ dl->dl_namesize = strlen(dl->dl_name) + 1; name = kmem_alloc(dl->dl_namesize, KM_SLEEP); - bcopy(dl->dl_name, name, dl->dl_namesize); + memcpy(name, dl->dl_name, dl->dl_namesize); dl->dl_name = name; } @@ -625,7 +625,7 @@ zfs_purgedir(znode_t *dzp) skipped += 1; continue; } - bzero(&dl, sizeof (dl)); + memset(&dl, 0, sizeof (dl)); dl.dl_dzp = dzp; dl.dl_name = zap.za_name; diff --git a/module/os/linux/zfs/zfs_uio.c b/module/os/linux/zfs/zfs_uio.c index a3d5d5f83..1b315c270 100644 --- a/module/os/linux/zfs/zfs_uio.c +++ b/module/os/linux/zfs/zfs_uio.c @@ -103,9 +103,9 @@ zfs_uiomove_iov(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio) break; case UIO_SYSSPACE: if (rw == UIO_READ) - bcopy(p, iov->iov_base + skip, cnt); + memcpy(iov->iov_base + skip, p, cnt); else - bcopy(iov->iov_base + skip, p, cnt); + memcpy(p, iov->iov_base + skip, cnt); break; default: ASSERT(0); @@ -138,9 +138,9 @@ zfs_uiomove_bvec(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio) paddr = zfs_kmap_atomic(bv->bv_page); if (rw == UIO_READ) - bcopy(p, paddr + bv->bv_offset + skip, cnt); + memcpy(paddr + bv->bv_offset + skip, p, cnt); else - bcopy(paddr + bv->bv_offset + skip, p, cnt); + memcpy(p, paddr + bv->bv_offset + skip, cnt); zfs_kunmap_atomic(paddr); skip += cnt; @@ -275,7 +275,7 @@ zfs_uiocopy(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio, size_t *cbytes) zfs_uio_t uio_copy; int ret; - bcopy(uio, &uio_copy, sizeof (zfs_uio_t)); + memcpy(&uio_copy, uio, sizeof (zfs_uio_t)); if (uio->uio_segflg == UIO_BVEC) ret = zfs_uiomove_bvec(p, n, rw, &uio_copy); diff --git a/module/os/linux/zfs/zfs_vfsops.c b/module/os/linux/zfs/zfs_vfsops.c index 412af0e88..81a059651 100644 --- a/module/os/linux/zfs/zfs_vfsops.c +++ b/module/os/linux/zfs/zfs_vfsops.c @@ -1137,7 +1137,7 @@ zfs_statvfs(struct inode *ip, struct kstatfs *statp) * We have all of 40 characters to stuff a string here. * Is there anything useful we could/should provide? */ - bzero(statp->f_spare, sizeof (statp->f_spare)); + memset(statp->f_spare, 0, sizeof (statp->f_spare)); if (dmu_objset_projectquota_enabled(zfsvfs->z_os) && dmu_objset_projectquota_present(zfsvfs->z_os)) { diff --git a/module/os/linux/zfs/zfs_znode.c b/module/os/linux/zfs/zfs_znode.c index d65d75312..b76e65d16 100644 --- a/module/os/linux/zfs/zfs_znode.c +++ b/module/os/linux/zfs/zfs_znode.c @@ -1581,7 +1581,7 @@ zfs_zero_partial_page(znode_t *zp, uint64_t start, uint64_t len) flush_dcache_page(pp); pb = kmap(pp); - bzero(pb + off, len); + memset(pb + off, 0, len); kunmap(pp); if (mapping_writably_mapped(mp)) @@ -2153,7 +2153,7 @@ zfs_obj_to_path_impl(objset_t *osp, uint64_t obj, sa_handle_t *hdl, component[0] = '/'; if (is_xattrdir) { - (void) sprintf(component + 1, "<xattrdir>"); + strcpy(component + 1, "<xattrdir>"); } else { error = zap_value_search(osp, pobj, obj, ZFS_DIRENT_OBJ(-1ULL), component + 1); @@ -2164,7 +2164,7 @@ zfs_obj_to_path_impl(objset_t *osp, uint64_t obj, sa_handle_t *hdl, complen = strlen(component); path -= complen; ASSERT(path >= buf); - bcopy(component, path, complen); + memcpy(path, component, complen); obj = pobj; if (sa_hdl != hdl) { diff --git a/module/os/linux/zfs/zio_crypt.c b/module/os/linux/zfs/zio_crypt.c index 099d23484..dcab02b07 100644 --- a/module/os/linux/zfs/zio_crypt.c +++ b/module/os/linux/zfs/zio_crypt.c @@ -216,7 +216,7 @@ zio_crypt_key_destroy(zio_crypt_key_t *key) crypto_destroy_ctx_template(key->zk_hmac_tmpl); /* zero out sensitive data */ - bzero(key, sizeof (zio_crypt_key_t)); + memset(key, 0, sizeof (zio_crypt_key_t)); } int @@ -230,7 +230,7 @@ zio_crypt_key_init(uint64_t crypt, zio_crypt_key_t *key) ASSERT3U(crypt, <, ZIO_CRYPT_FUNCTIONS); keydata_len = zio_crypt_table[crypt].ci_keylen; - bzero(key, sizeof (zio_crypt_key_t)); + memset(key, 0, sizeof (zio_crypt_key_t)); /* fill keydata buffers and salt with random data */ ret = random_get_bytes((uint8_t *)&key->zk_guid, sizeof (uint64_t)); @@ -317,7 +317,7 @@ zio_crypt_key_change_salt(zio_crypt_key_t *key) goto out_unlock; /* assign the salt and reset the usage count */ - bcopy(salt, key->zk_salt, ZIO_DATA_SALT_LEN); + memcpy(key->zk_salt, salt, ZIO_DATA_SALT_LEN); key->zk_salt_count = 0; /* destroy the old context template and create the new one */ @@ -346,7 +346,7 @@ zio_crypt_key_get_salt(zio_crypt_key_t *key, uint8_t *salt) rw_enter(&key->zk_salt_lock, RW_READER); - bcopy(key->zk_salt, salt, ZIO_DATA_SALT_LEN); + memcpy(salt, key->zk_salt, ZIO_DATA_SALT_LEN); salt_change = (atomic_inc_64_nv(&key->zk_salt_count) >= ZFS_CURRENT_MAX_SALT_USES); @@ -652,7 +652,7 @@ zio_crypt_generate_iv(uint8_t *ivbuf) return (0); error: - bzero(ivbuf, ZIO_DATA_IV_LEN); + memset(ivbuf, 0, ZIO_DATA_IV_LEN); return (ret); } @@ -693,12 +693,12 @@ zio_crypt_do_hmac(zio_crypt_key_t *key, uint8_t *data, uint_t datalen, goto error; } - bcopy(raw_digestbuf, digestbuf, digestlen); + memcpy(digestbuf, raw_digestbuf, digestlen); return (0); error: - bzero(digestbuf, digestlen); + memset(digestbuf, 0, digestlen); return (ret); } @@ -714,8 +714,8 @@ zio_crypt_generate_iv_salt_dedup(zio_crypt_key_t *key, uint8_t *data, if (ret != 0) return (ret); - bcopy(digestbuf, salt, ZIO_DATA_SALT_LEN); - bcopy(digestbuf + ZIO_DATA_SALT_LEN, ivbuf, ZIO_DATA_IV_LEN); + memcpy(salt, digestbuf, ZIO_DATA_SALT_LEN); + memcpy(ivbuf, digestbuf + ZIO_DATA_SALT_LEN, ZIO_DATA_IV_LEN); return (0); } @@ -738,18 +738,18 @@ zio_crypt_encode_params_bp(blkptr_t *bp, uint8_t *salt, uint8_t *iv) ASSERT(BP_IS_ENCRYPTED(bp)); if (!BP_SHOULD_BYTESWAP(bp)) { - bcopy(salt, &bp->blk_dva[2].dva_word[0], sizeof (uint64_t)); - bcopy(iv, &bp->blk_dva[2].dva_word[1], sizeof (uint64_t)); - bcopy(iv + sizeof (uint64_t), &val32, sizeof (uint32_t)); + memcpy(&bp->blk_dva[2].dva_word[0], salt, sizeof (uint64_t)); + memcpy(&bp->blk_dva[2].dva_word[1], iv, sizeof (uint64_t)); + memcpy(&val32, iv + sizeof (uint64_t), sizeof (uint32_t)); BP_SET_IV2(bp, val32); } else { - bcopy(salt, &val64, sizeof (uint64_t)); + memcpy(&val64, salt, sizeof (uint64_t)); bp->blk_dva[2].dva_word[0] = BSWAP_64(val64); - bcopy(iv, &val64, sizeof (uint64_t)); + memcpy(&val64, iv, sizeof (uint64_t)); bp->blk_dva[2].dva_word[1] = BSWAP_64(val64); - bcopy(iv + sizeof (uint64_t), &val32, sizeof (uint32_t)); + memcpy(&val32, iv + sizeof (uint64_t), sizeof (uint32_t)); BP_SET_IV2(bp, BSWAP_32(val32)); } } @@ -764,26 +764,26 @@ zio_crypt_decode_params_bp(const blkptr_t *bp, uint8_t *salt, uint8_t *iv) /* for convenience, so callers don't need to check */ if (BP_IS_AUTHENTICATED(bp)) { - bzero(salt, ZIO_DATA_SALT_LEN); - bzero(iv, ZIO_DATA_IV_LEN); + memset(salt, 0, ZIO_DATA_SALT_LEN); + memset(iv, 0, ZIO_DATA_IV_LEN); return; } if (!BP_SHOULD_BYTESWAP(bp)) { - bcopy(&bp->blk_dva[2].dva_word[0], salt, sizeof (uint64_t)); - bcopy(&bp->blk_dva[2].dva_word[1], iv, sizeof (uint64_t)); + memcpy(salt, &bp->blk_dva[2].dva_word[0], sizeof (uint64_t)); + memcpy(iv, &bp->blk_dva[2].dva_word[1], sizeof (uint64_t)); val32 = (uint32_t)BP_GET_IV2(bp); - bcopy(&val32, iv + sizeof (uint64_t), sizeof (uint32_t)); + memcpy(iv + sizeof (uint64_t), &val32, sizeof (uint32_t)); } else { val64 = BSWAP_64(bp->blk_dva[2].dva_word[0]); - bcopy(&val64, salt, sizeof (uint64_t)); + memcpy(salt, &val64, sizeof (uint64_t)); val64 = BSWAP_64(bp->blk_dva[2].dva_word[1]); - bcopy(&val64, iv, sizeof (uint64_t)); + memcpy(iv, &val64, sizeof (uint64_t)); val32 = BSWAP_32((uint32_t)BP_GET_IV2(bp)); - bcopy(&val32, iv + sizeof (uint64_t), sizeof (uint32_t)); + memcpy(iv + sizeof (uint64_t), &val32, sizeof (uint32_t)); } } @@ -796,14 +796,14 @@ zio_crypt_encode_mac_bp(blkptr_t *bp, uint8_t *mac) ASSERT3U(BP_GET_TYPE(bp), !=, DMU_OT_OBJSET); if (!BP_SHOULD_BYTESWAP(bp)) { - bcopy(mac, &bp->blk_cksum.zc_word[2], sizeof (uint64_t)); - bcopy(mac + sizeof (uint64_t), &bp->blk_cksum.zc_word[3], + memcpy(&bp->blk_cksum.zc_word[2], mac, sizeof (uint64_t)); + memcpy(&bp->blk_cksum.zc_word[3], mac + sizeof (uint64_t), sizeof (uint64_t)); } else { - bcopy(mac, &val64, sizeof (uint64_t)); + memcpy(&val64, mac, sizeof (uint64_t)); bp->blk_cksum.zc_word[2] = BSWAP_64(val64); - bcopy(mac + sizeof (uint64_t), &val64, sizeof (uint64_t)); + memcpy(&val64, mac + sizeof (uint64_t), sizeof (uint64_t)); bp->blk_cksum.zc_word[3] = BSWAP_64(val64); } } @@ -817,20 +817,20 @@ zio_crypt_decode_mac_bp(const blkptr_t *bp, uint8_t *mac) /* for convenience, so callers don't need to check */ if (BP_GET_TYPE(bp) == DMU_OT_OBJSET) { - bzero(mac, ZIO_DATA_MAC_LEN); + memset(mac, 0, ZIO_DATA_MAC_LEN); return; } if (!BP_SHOULD_BYTESWAP(bp)) { - bcopy(&bp->blk_cksum.zc_word[2], mac, sizeof (uint64_t)); - bcopy(&bp->blk_cksum.zc_word[3], mac + sizeof (uint64_t), + memcpy(mac, &bp->blk_cksum.zc_word[2], sizeof (uint64_t)); + memcpy(mac + sizeof (uint64_t), &bp->blk_cksum.zc_word[3], sizeof (uint64_t)); } else { val64 = BSWAP_64(bp->blk_cksum.zc_word[2]); - bcopy(&val64, mac, sizeof (uint64_t)); + memcpy(mac, &val64, sizeof (uint64_t)); val64 = BSWAP_64(bp->blk_cksum.zc_word[3]); - bcopy(&val64, mac + sizeof (uint64_t), sizeof (uint64_t)); + memcpy(mac + sizeof (uint64_t), &val64, sizeof (uint64_t)); } } @@ -839,8 +839,8 @@ zio_crypt_encode_mac_zil(void *data, uint8_t *mac) { zil_chain_t *zilc = data; - bcopy(mac, &zilc->zc_eck.zec_cksum.zc_word[2], sizeof (uint64_t)); - bcopy(mac + sizeof (uint64_t), &zilc->zc_eck.zec_cksum.zc_word[3], + memcpy(&zilc->zc_eck.zec_cksum.zc_word[2], mac, sizeof (uint64_t)); + memcpy(&zilc->zc_eck.zec_cksum.zc_word[3], mac + sizeof (uint64_t), sizeof (uint64_t)); } @@ -854,8 +854,8 @@ zio_crypt_decode_mac_zil(const void *data, uint8_t *mac) */ const zil_chain_t *zilc = data; - bcopy(&zilc->zc_eck.zec_cksum.zc_word[2], mac, sizeof (uint64_t)); - bcopy(&zilc->zc_eck.zec_cksum.zc_word[3], mac + sizeof (uint64_t), + memcpy(mac, &zilc->zc_eck.zec_cksum.zc_word[2], sizeof (uint64_t)); + memcpy(mac + sizeof (uint64_t), &zilc->zc_eck.zec_cksum.zc_word[3], sizeof (uint64_t)); } @@ -882,7 +882,7 @@ zio_crypt_copy_dnode_bonus(abd_t *src_abd, uint8_t *dst, uint_t datalen) if (dnp->dn_type != DMU_OT_NONE && DMU_OT_IS_ENCRYPTED(dnp->dn_bonustype) && dnp->dn_bonuslen != 0) { - bcopy(DN_BONUS(dnp), DN_BONUS(&ddnp[i]), + memcpy(DN_BONUS(&ddnp[i]), DN_BONUS(dnp), DN_MAX_BONUS_LEN(dnp)); } } @@ -1024,7 +1024,7 @@ zio_crypt_bp_do_aad_updates(uint8_t **aadp, uint_t *aad_len, uint64_t version, blkptr_auth_buf_t bab; zio_crypt_bp_auth_init(version, should_bswap, bp, &bab, &bab_len); - bcopy(&bab, *aadp, bab_len); + memcpy(*aadp, &bab, bab_len); *aadp += bab_len; *aad_len += bab_len; } @@ -1048,7 +1048,7 @@ zio_crypt_do_dnode_hmac_updates(crypto_context_t ctx, uint64_t version, * of copying 512-64 unneeded bytes. The compiler seems to be fine * with that. */ - bcopy(dnp, &tmp_dncore, dn_core_size); + memcpy(&tmp_dncore, dnp, dn_core_size); adnp = &tmp_dncore; if (le_bswap) { @@ -1190,7 +1190,7 @@ zio_crypt_do_objset_hmacs(zio_crypt_key_t *key, void *data, uint_t datalen, goto error; } - bcopy(raw_portable_mac, portable_mac, ZIO_OBJSET_MAC_LEN); + memcpy(portable_mac, raw_portable_mac, ZIO_OBJSET_MAC_LEN); /* * This is necessary here as we check next whether @@ -1219,7 +1219,7 @@ zio_crypt_do_objset_hmacs(zio_crypt_key_t *key, void *data, uint_t datalen, osp->os_userused_dnode.dn_type == DMU_OT_NONE && osp->os_groupused_dnode.dn_type == DMU_OT_NONE) || (datalen <= OBJSET_PHYS_SIZE_V1)) { - bzero(local_mac, ZIO_OBJSET_MAC_LEN); + memset(local_mac, 0, ZIO_OBJSET_MAC_LEN); return (0); } @@ -1282,13 +1282,13 @@ zio_crypt_do_objset_hmacs(zio_crypt_key_t *key, void *data, uint_t datalen, goto error; } - bcopy(raw_local_mac, local_mac, ZIO_OBJSET_MAC_LEN); + memcpy(local_mac, raw_local_mac, ZIO_OBJSET_MAC_LEN); return (0); error: - bzero(portable_mac, ZIO_OBJSET_MAC_LEN); - bzero(local_mac, ZIO_OBJSET_MAC_LEN); + memset(portable_mac, 0, ZIO_OBJSET_MAC_LEN); + memset(local_mac, 0, ZIO_OBJSET_MAC_LEN); return (ret); } @@ -1324,11 +1324,11 @@ zio_crypt_do_indirect_mac_checksum_impl(boolean_t generate, void *buf, SHA2Final(digestbuf, &ctx); if (generate) { - bcopy(digestbuf, cksum, ZIO_DATA_MAC_LEN); + memcpy(cksum, digestbuf, ZIO_DATA_MAC_LEN); return (0); } - if (bcmp(digestbuf, cksum, ZIO_DATA_MAC_LEN) != 0) + if (memcmp(digestbuf, cksum, ZIO_DATA_MAC_LEN) != 0) return (SET_ERROR(ECKSUM)); return (0); @@ -1409,7 +1409,7 @@ zio_crypt_init_uios_zil(boolean_t encrypt, uint8_t *plainbuf, nr_src = 1; nr_dst = 0; } - bzero(dst, datalen); + memset(dst, 0, datalen); /* find the start and end record of the log block */ zilc = (zil_chain_t *)src; @@ -1460,8 +1460,8 @@ zio_crypt_init_uios_zil(boolean_t encrypt, uint8_t *plainbuf, * the embedded checksum will not have been calculated yet, so we don't * authenticate that. */ - bcopy(src, dst, sizeof (zil_chain_t)); - bcopy(src, aadp, sizeof (zil_chain_t) - sizeof (zio_eck_t)); + memcpy(dst, src, sizeof (zil_chain_t)); + memcpy(aadp, src, sizeof (zil_chain_t) - sizeof (zio_eck_t)); aadp += sizeof (zil_chain_t) - sizeof (zio_eck_t); aad_len += sizeof (zil_chain_t) - sizeof (zio_eck_t); @@ -1482,8 +1482,8 @@ zio_crypt_init_uios_zil(boolean_t encrypt, uint8_t *plainbuf, } /* copy the common lr_t */ - bcopy(slrp, dlrp, sizeof (lr_t)); - bcopy(slrp, aadp, sizeof (lr_t)); + memcpy(dlrp, slrp, sizeof (lr_t)); + memcpy(aadp, slrp, sizeof (lr_t)); aadp += sizeof (lr_t); aad_len += sizeof (lr_t); @@ -1504,11 +1504,12 @@ zio_crypt_init_uios_zil(boolean_t encrypt, uint8_t *plainbuf, dst_iovecs[nr_iovecs].iov_len = crypt_len; /* copy the bp now since it will not be encrypted */ - bcopy(slrp + sizeof (lr_write_t) - sizeof (blkptr_t), - dlrp + sizeof (lr_write_t) - sizeof (blkptr_t), + memcpy(dlrp + sizeof (lr_write_t) - sizeof (blkptr_t), + slrp + sizeof (lr_write_t) - sizeof (blkptr_t), + sizeof (blkptr_t)); + memcpy(aadp, + slrp + sizeof (lr_write_t) - sizeof (blkptr_t), sizeof (blkptr_t)); - bcopy(slrp + sizeof (lr_write_t) - sizeof (blkptr_t), - aadp, sizeof (blkptr_t)); aadp += sizeof (blkptr_t); aad_len += sizeof (blkptr_t); nr_iovecs++; @@ -1655,10 +1656,11 @@ zio_crypt_init_uios_dnode(boolean_t encrypt, uint64_t version, dnp = &sdnp[i]; /* copy over the core fields and blkptrs (kept as plaintext) */ - bcopy(dnp, &ddnp[i], (uint8_t *)DN_BONUS(dnp) - (uint8_t *)dnp); + memcpy(&ddnp[i], dnp, + (uint8_t *)DN_BONUS(dnp) - (uint8_t *)dnp); if (dnp->dn_flags & DNODE_FLAG_SPILL_BLKPTR) { - bcopy(DN_SPILL_BLKPTR(dnp), DN_SPILL_BLKPTR(&ddnp[i]), + memcpy(DN_SPILL_BLKPTR(&ddnp[i]), DN_SPILL_BLKPTR(dnp), sizeof (blkptr_t)); } @@ -1673,7 +1675,7 @@ zio_crypt_init_uios_dnode(boolean_t encrypt, uint64_t version, * authenticated data. */ crypt_len = offsetof(dnode_phys_t, dn_blkptr); - bcopy(dnp, aadp, crypt_len); + memcpy(aadp, dnp, crypt_len); adnp = (dnode_phys_t *)aadp; adnp->dn_flags &= DNODE_CRYPT_PORTABLE_FLAGS_MASK; adnp->dn_used = 0; @@ -1716,8 +1718,8 @@ zio_crypt_init_uios_dnode(boolean_t encrypt, uint64_t version, nr_iovecs++; total_len += crypt_len; } else { - bcopy(DN_BONUS(dnp), DN_BONUS(&ddnp[i]), crypt_len); - bcopy(DN_BONUS(dnp), aadp, crypt_len); + memcpy(DN_BONUS(&ddnp[i]), DN_BONUS(dnp), crypt_len); + memcpy(aadp, DN_BONUS(dnp), crypt_len); aadp += crypt_len; aad_len += crypt_len; } @@ -1898,7 +1900,7 @@ zio_do_crypt_data(boolean_t encrypt, zio_crypt_key_t *key, rw_enter(&key->zk_salt_lock, RW_READER); locked = B_TRUE; - if (bcmp(salt, key->zk_salt, ZIO_DATA_SALT_LEN) == 0) { + if (memcmp(salt, key->zk_salt, ZIO_DATA_SALT_LEN) == 0) { ckey = &key->zk_current_key; tmpl = key->zk_current_tmpl; } else { @@ -1948,8 +1950,8 @@ zio_do_crypt_data(boolean_t encrypt, zio_crypt_key_t *key, /* If the hardware implementation fails fall back to software */ } - bzero(&puio, sizeof (zfs_uio_t)); - bzero(&cuio, sizeof (zfs_uio_t)); + memset(&puio, 0, sizeof (puio)); + memset(&cuio, 0, sizeof (cuio)); /* create uios for encryption */ ret = zio_crypt_init_uios(encrypt, key->zk_version, ot, plainbuf, @@ -1972,7 +1974,7 @@ zio_do_crypt_data(boolean_t encrypt, zio_crypt_key_t *key, if (authbuf != NULL) zio_buf_free(authbuf, datalen); if (ckey == &tmp_ckey) - bzero(enc_keydata, keydata_len); + memset(enc_keydata, 0, keydata_len); zio_crypt_destroy_uio(&puio); zio_crypt_destroy_uio(&cuio); @@ -1984,7 +1986,7 @@ error: if (authbuf != NULL) zio_buf_free(authbuf, datalen); if (ckey == &tmp_ckey) - bzero(enc_keydata, keydata_len); + memset(enc_keydata, 0, keydata_len); zio_crypt_destroy_uio(&puio); zio_crypt_destroy_uio(&cuio); |