aboutsummaryrefslogtreecommitdiff
path: root/module/os
diff options
context:
space:
mode:
Diffstat (limited to 'module/os')
-rw-r--r--module/os/freebsd/spl/acl_common.c2
-rw-r--r--module/os/freebsd/spl/sha256c.c4
-rw-r--r--module/os/freebsd/spl/sha512c.c8
-rw-r--r--module/os/freebsd/spl/spl_acl.c8
-rw-r--r--module/os/freebsd/spl/spl_vfs.c2
-rw-r--r--module/os/freebsd/spl/spl_zlib.c7
-rw-r--r--module/os/freebsd/spl/spl_zone.c4
-rw-r--r--module/os/freebsd/zfs/abd_os.c2
-rw-r--r--module/os/freebsd/zfs/crypto_os.c32
-rw-r--r--module/os/freebsd/zfs/dmu_os.c12
-rw-r--r--module/os/freebsd/zfs/hkdf.c2
-rw-r--r--module/os/freebsd/zfs/zfs_acl.c24
-rw-r--r--module/os/freebsd/zfs/zfs_ctldir.c4
-rw-r--r--module/os/freebsd/zfs/zfs_vnops_os.c6
-rw-r--r--module/os/freebsd/zfs/zfs_znode.c2
-rw-r--r--module/os/freebsd/zfs/zio_crypt.c148
-rw-r--r--module/os/linux/spl/spl-generic.c1
-rw-r--r--module/os/linux/zfs/qat_crypt.c10
-rw-r--r--module/os/linux/zfs/zfs_acl.c24
-rw-r--r--module/os/linux/zfs/zfs_dir.c4
-rw-r--r--module/os/linux/zfs/zfs_uio.c10
-rw-r--r--module/os/linux/zfs/zfs_vfsops.c2
-rw-r--r--module/os/linux/zfs/zfs_znode.c6
-rw-r--r--module/os/linux/zfs/zio_crypt.c132
24 files changed, 225 insertions, 231 deletions
diff --git a/module/os/freebsd/spl/acl_common.c b/module/os/freebsd/spl/acl_common.c
index 7fd0e36e1ba7..718d0de8b31a 100644
--- a/module/os/freebsd/spl/acl_common.c
+++ b/module/os/freebsd/spl/acl_common.c
@@ -738,7 +738,7 @@ out:
static void
acevals_init(acevals_t *vals, uid_t key)
{
- bzero(vals, sizeof (*vals));
+ memset(vals, 0, sizeof (*vals));
vals->allowed = ACE_MASK_UNDEFINED;
vals->denied = ACE_MASK_UNDEFINED;
vals->mask = ACE_MASK_UNDEFINED;
diff --git a/module/os/freebsd/spl/sha256c.c b/module/os/freebsd/spl/sha256c.c
index 241cf8c9ae76..52cf0df6c99d 100644
--- a/module/os/freebsd/spl/sha256c.c
+++ b/module/os/freebsd/spl/sha256c.c
@@ -301,7 +301,7 @@ SHA256_Final(unsigned char digest[static SHA256_DIGEST_LENGTH], SHA256_CTX *ctx)
be32enc_vect(digest, ctx->state, SHA256_DIGEST_LENGTH);
/* Clear the context state */
- explicit_bzero(ctx, sizeof (*ctx));
+ memset(ctx, 0, sizeof (*ctx));
}
/* SHA-224: ******************************************************* */
@@ -351,7 +351,7 @@ SHA224_Final(unsigned char digest[static SHA224_DIGEST_LENGTH], SHA224_CTX *ctx)
be32enc_vect(digest, ctx->state, SHA224_DIGEST_LENGTH);
/* Clear the context state */
- explicit_bzero(ctx, sizeof (*ctx));
+ memset(ctx, 0, sizeof (*ctx));
}
#ifdef WEAK_REFS
diff --git a/module/os/freebsd/spl/sha512c.c b/module/os/freebsd/spl/sha512c.c
index 146f338f0ed4..254cc21565c1 100644
--- a/module/os/freebsd/spl/sha512c.c
+++ b/module/os/freebsd/spl/sha512c.c
@@ -333,7 +333,7 @@ SHA512_Final(unsigned char digest[static SHA512_DIGEST_LENGTH], SHA512_CTX *ctx)
be64enc_vect(digest, ctx->state, SHA512_DIGEST_LENGTH);
/* Clear the context state */
- explicit_bzero(ctx, sizeof (*ctx));
+ memset(ctx, 0, sizeof (*ctx));
}
/* SHA-512t: ******************************************************** */
@@ -377,7 +377,7 @@ SHA512_224_Final(unsigned char digest[static SHA512_224_DIGEST_LENGTH],
be64enc_vect(digest, ctx->state, SHA512_224_DIGEST_LENGTH);
/* Clear the context state */
- explicit_bzero(ctx, sizeof (*ctx));
+ memset(ctx, 0, sizeof (*ctx));
}
void
@@ -417,7 +417,7 @@ SHA512_256_Final(unsigned char digest[static SHA512_256_DIGEST_LENGTH],
be64enc_vect(digest, ctx->state, SHA512_256_DIGEST_LENGTH);
/* Clear the context state */
- explicit_bzero(ctx, sizeof (*ctx));
+ memset(ctx, 0, sizeof (*ctx));
}
/* ** SHA-384: ******************************************************** */
@@ -467,7 +467,7 @@ SHA384_Final(unsigned char digest[static SHA384_DIGEST_LENGTH], SHA384_CTX *ctx)
be64enc_vect(digest, ctx->state, SHA384_DIGEST_LENGTH);
/* Clear the context state */
- explicit_bzero(ctx, sizeof (*ctx));
+ memset(ctx, 0, sizeof (*ctx));
}
#if 0
diff --git a/module/os/freebsd/spl/spl_acl.c b/module/os/freebsd/spl/spl_acl.c
index 74c26d03f87f..4d67cbb183ec 100644
--- a/module/os/freebsd/spl/spl_acl.c
+++ b/module/os/freebsd/spl/spl_acl.c
@@ -40,7 +40,7 @@ struct zfs2bsd {
int zb_bsd;
};
-struct zfs2bsd perms[] = {{ACE_READ_DATA, ACL_READ_DATA},
+static const struct zfs2bsd perms[] = {{ACE_READ_DATA, ACL_READ_DATA},
{ACE_WRITE_DATA, ACL_WRITE_DATA},
{ACE_EXECUTE, ACL_EXECUTE},
{ACE_APPEND_DATA, ACL_APPEND_DATA},
@@ -56,7 +56,7 @@ struct zfs2bsd perms[] = {{ACE_READ_DATA, ACL_READ_DATA},
{ACE_SYNCHRONIZE, ACL_SYNCHRONIZE},
{0, 0}};
-struct zfs2bsd flags[] = {{ACE_FILE_INHERIT_ACE,
+static const struct zfs2bsd flags[] = {{ACE_FILE_INHERIT_ACE,
ACL_ENTRY_FILE_INHERIT},
{ACE_DIRECTORY_INHERIT_ACE,
ACL_ENTRY_DIRECTORY_INHERIT},
@@ -122,7 +122,7 @@ acl_from_aces(struct acl *aclp, const ace_t *aces, int nentries)
return (EINVAL);
}
- bzero(aclp, sizeof (*aclp));
+ memset(aclp, 0, sizeof (*aclp));
aclp->acl_maxcnt = ACL_MAX_ENTRIES;
aclp->acl_cnt = nentries;
@@ -177,7 +177,7 @@ aces_from_acl(ace_t *aces, int *nentries, const struct acl *aclp)
const struct acl_entry *entry;
ace_t *ace;
- bzero(aces, sizeof (*aces) * aclp->acl_cnt);
+ memset(aces, 0, sizeof (*aces) * aclp->acl_cnt);
*nentries = aclp->acl_cnt;
diff --git a/module/os/freebsd/spl/spl_vfs.c b/module/os/freebsd/spl/spl_vfs.c
index 3f4feb140d5e..ff11f5d7acb8 100644
--- a/module/os/freebsd/spl/spl_vfs.c
+++ b/module/os/freebsd/spl/spl_vfs.c
@@ -85,7 +85,7 @@ vfs_setmntopt(vfs_t *vfsp, const char *name, const char *arg,
} else {
opt->len = strlen(arg) + 1;
opt->value = malloc(opt->len, M_MOUNT, M_WAITOK);
- bcopy(arg, opt->value, opt->len);
+ memcpy(opt->value, arg, opt->len);
}
MNT_ILOCK(vfsp);
diff --git a/module/os/freebsd/spl/spl_zlib.c b/module/os/freebsd/spl/spl_zlib.c
index fa2b0a2b6903..8bd3bdedf268 100644
--- a/module/os/freebsd/spl/spl_zlib.c
+++ b/module/os/freebsd/spl/spl_zlib.c
@@ -141,10 +141,9 @@ int
z_compress_level(void *dest, size_t *destLen, const void *source,
size_t sourceLen, int level)
{
- z_stream stream;
+ z_stream stream = {0};
int err;
- bzero(&stream, sizeof (stream));
stream.next_in = (Byte *)source;
stream.avail_in = (uInt)sourceLen;
stream.next_out = dest;
@@ -196,11 +195,9 @@ z_compress_level(void *dest, size_t *destLen, const void *source,
int
z_uncompress(void *dest, size_t *destLen, const void *source, size_t sourceLen)
{
- z_stream stream;
+ z_stream stream = {0};
int err;
- bzero(&stream, sizeof (stream));
-
stream.next_in = (Byte *)source;
stream.avail_in = (uInt)sourceLen;
stream.next_out = dest;
diff --git a/module/os/freebsd/spl/spl_zone.c b/module/os/freebsd/spl/spl_zone.c
index bd3f019b2fa6..658ef0bf056d 100644
--- a/module/os/freebsd/spl/spl_zone.c
+++ b/module/os/freebsd/spl/spl_zone.c
@@ -184,7 +184,7 @@ zone_dataset_visible(const char *dataset, int *write)
LIST_FOREACH(zd, head, zd_next) {
len = strlen(zd->zd_dataset);
if (strlen(dataset) >= len &&
- bcmp(dataset, zd->zd_dataset, len) == 0 &&
+ memcmp(dataset, zd->zd_dataset, len) == 0 &&
(dataset[len] == '\0' || dataset[len] == '/' ||
dataset[len] == '@')) {
if (write)
@@ -206,7 +206,7 @@ zone_dataset_visible(const char *dataset, int *write)
if (dataset[len - 1] == '/')
len--; /* Ignore trailing slash */
if (len < strlen(zd->zd_dataset) &&
- bcmp(dataset, zd->zd_dataset, len) == 0 &&
+ memcmp(dataset, zd->zd_dataset, len) == 0 &&
zd->zd_dataset[len] == '/') {
if (write)
*write = 0;
diff --git a/module/os/freebsd/zfs/abd_os.c b/module/os/freebsd/zfs/abd_os.c
index 722a8898cde8..5d2bae5cfeb4 100644
--- a/module/os/freebsd/zfs/abd_os.c
+++ b/module/os/freebsd/zfs/abd_os.c
@@ -250,7 +250,7 @@ abd_alloc_zero_scatter(void)
n = abd_chunkcnt_for_bytes(SPA_MAXBLOCKSIZE);
abd_zero_buf = kmem_cache_alloc(abd_chunk_cache, KM_PUSHPAGE);
- bzero(abd_zero_buf, PAGE_SIZE);
+ memset(abd_zero_buf, 0, PAGE_SIZE);
abd_zero_scatter = abd_alloc_struct(SPA_MAXBLOCKSIZE);
abd_zero_scatter->abd_flags |= ABD_FLAG_OWNER | ABD_FLAG_ZEROS;
diff --git a/module/os/freebsd/zfs/crypto_os.c b/module/os/freebsd/zfs/crypto_os.c
index 73083f59f532..ddb95b0d8d19 100644
--- a/module/os/freebsd/zfs/crypto_os.c
+++ b/module/os/freebsd/zfs/crypto_os.c
@@ -69,11 +69,11 @@ crypto_mac_init(struct hmac_ctx *ctx, const crypto_key_t *c_key)
/*
* This code is based on the similar code in geom/eli/g_eli_hmac.c
*/
- explicit_bzero(key, sizeof (key));
+ memset(key, 0, sizeof (key));
if (c_key->ck_length == 0)
/* do nothing */;
else if (cl_bytes <= SHA512_HMAC_BLOCK_SIZE)
- bcopy(c_key->ck_data, key, cl_bytes);
+ memcpy(key, c_key->ck_data, cl_bytes);
else {
/*
* If key is longer than 128 bytes reset it to
@@ -89,16 +89,16 @@ crypto_mac_init(struct hmac_ctx *ctx, const crypto_key_t *c_key)
k_ipad[i] = key[i] ^ 0x36;
k_opad[i] = key[i] ^ 0x5c;
}
- explicit_bzero(key, sizeof (key));
+ memset(key, 0, sizeof (key));
/* Start inner SHA512. */
SHA512_Init(&ctx->innerctx);
SHA512_Update(&ctx->innerctx, k_ipad, sizeof (k_ipad));
- explicit_bzero(k_ipad, sizeof (k_ipad));
+ memset(k_ipad, 0, sizeof (k_ipad));
/* Start outer SHA512. */
SHA512_Init(&ctx->outerctx);
SHA512_Update(&ctx->outerctx, k_opad, sizeof (k_opad));
- explicit_bzero(k_opad, sizeof (k_opad));
+ memset(k_opad, 0, sizeof (k_opad));
}
void
@@ -119,12 +119,12 @@ crypto_mac_final(struct hmac_ctx *ctx, void *md, size_t mdsize)
SHA512_Update(&ctx->outerctx, digest, sizeof (digest));
SHA512_Final(digest, &ctx->outerctx);
- explicit_bzero(ctx, sizeof (*ctx));
+ memset(ctx, 0, sizeof (*ctx));
/* mdsize == 0 means "Give me the whole hash!" */
if (mdsize == 0)
mdsize = SHA512_DIGEST_LENGTH;
- bcopy(digest, md, mdsize);
- explicit_bzero(digest, sizeof (digest));
+ memcpy(md, digest, mdsize);
+ memset(digest, 0, sizeof (digest));
}
void
@@ -156,7 +156,7 @@ freebsd_crypt_freesession(freebsd_crypt_session_t *sess)
{
mtx_destroy(&sess->fs_lock);
crypto_freesession(sess->fs_sid);
- explicit_bzero(sess, sizeof (*sess));
+ memset(sess, 0, sizeof (*sess));
}
static int
@@ -243,7 +243,7 @@ int
freebsd_crypt_newsession(freebsd_crypt_session_t *sessp,
const struct zio_crypt_info *c_info, crypto_key_t *key)
{
- struct crypto_session_params csp;
+ struct crypto_session_params csp = {0};
int error = 0;
#ifdef FCRYPTO_DEBUG
@@ -259,7 +259,6 @@ freebsd_crypt_newsession(freebsd_crypt_session_t *sessp,
}
printf("}\n");
#endif
- bzero(&csp, sizeof (csp));
csp.csp_mode = CSP_MODE_AEAD;
csp.csp_cipher_key = key->ck_data;
csp.csp_cipher_klen = key->ck_length / 8;
@@ -364,7 +363,7 @@ freebsd_crypt_uio(boolean_t encrypt,
crp->crp_payload_length = datalen;
crp->crp_digest_start = auth_len + datalen;
- bcopy(ivbuf, crp->crp_iv, ZIO_DATA_IV_LEN);
+ memcpy(crp->crp_iv, ivbuf, ZIO_DATA_IV_LEN);
error = zfs_crypto_dispatch(session, crp);
crypto_freereq(crp);
out:
@@ -384,7 +383,7 @@ int
freebsd_crypt_newsession(freebsd_crypt_session_t *sessp,
const struct zio_crypt_info *c_info, crypto_key_t *key)
{
- struct cryptoini cria, crie, *crip;
+ struct cryptoini cria = {0}, crie = {0}, *crip;
struct enc_xform *xform;
struct auth_hash *xauth;
int error = 0;
@@ -452,9 +451,6 @@ freebsd_crypt_newsession(freebsd_crypt_session_t *sessp,
xauth->name, xauth->keysize);
#endif
- bzero(&crie, sizeof (crie));
- bzero(&cria, sizeof (cria));
-
crie.cri_alg = xform->type;
crie.cri_key = key->ck_data;
crie.cri_klen = key->ck_length;
@@ -466,7 +462,7 @@ freebsd_crypt_newsession(freebsd_crypt_session_t *sessp,
cria.cri_next = &crie;
crie.cri_next = NULL;
crip = &cria;
- // Everything else is bzero'd
+ // Everything else is zero-initialised
error = crypto_newsession(&sid, crip,
CRYPTOCAP_F_HARDWARE | CRYPTOCAP_F_SOFTWARE);
@@ -595,7 +591,7 @@ freebsd_crypt_uio(boolean_t encrypt,
enc_desc->crd_inject = auth_len;
enc_desc->crd_alg = xform->type;
enc_desc->crd_flags = CRD_F_IV_EXPLICIT | CRD_F_IV_PRESENT;
- bcopy(ivbuf, enc_desc->crd_iv, ZIO_DATA_IV_LEN);
+ memcpy(enc_desc->crd_iv, ivbuf, ZIO_DATA_IV_LEN);
enc_desc->crd_next = NULL;
#ifdef FCRYPTO_DEBUG
diff --git a/module/os/freebsd/zfs/dmu_os.c b/module/os/freebsd/zfs/dmu_os.c
index 38488dbda6f4..a5f486b95db4 100644
--- a/module/os/freebsd/zfs/dmu_os.c
+++ b/module/os/freebsd/zfs/dmu_os.c
@@ -119,7 +119,7 @@ dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, uint64_t size,
db->db_offset + bufoff);
thiscpy = MIN(PAGESIZE, tocpy - copied);
va = zfs_map_page(*ma, &sf);
- bcopy(va, (char *)db->db_data + bufoff, thiscpy);
+ memcpy((char *)db->db_data + bufoff, va, thiscpy);
zfs_unmap_page(sf);
ma += 1;
bufoff += PAGESIZE;
@@ -189,7 +189,7 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_t *ma, int count,
ASSERT3U(db->db_size, >, PAGE_SIZE);
bufoff = IDX_TO_OFF(m->pindex) % db->db_size;
va = zfs_map_page(m, &sf);
- bcopy((char *)db->db_data + bufoff, va, PAGESIZE);
+ memcpy(va, (char *)db->db_data + bufoff, PAGESIZE);
zfs_unmap_page(sf);
vm_page_valid(m);
dmu_page_lock(m);
@@ -231,7 +231,7 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_t *ma, int count,
tocpy = MIN(db->db_size - bufoff, PAGESIZE - pgoff);
ASSERT3S(tocpy, >=, 0);
if (m != bogus_page)
- bcopy((char *)db->db_data + bufoff, va + pgoff, tocpy);
+ memcpy(va + pgoff, (char *)db->db_data + bufoff, tocpy);
pgoff += tocpy;
ASSERT3S(pgoff, >=, 0);
@@ -287,7 +287,7 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_t *ma, int count,
#endif
if (pgoff != 0) {
ASSERT3P(m, !=, bogus_page);
- bzero(va + pgoff, PAGESIZE - pgoff);
+ memset(va + pgoff, 0, PAGESIZE - pgoff);
zfs_unmap_page(sf);
vm_page_valid(m);
}
@@ -309,11 +309,11 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_t *ma, int count,
bufoff = IDX_TO_OFF(m->pindex) % db->db_size;
tocpy = MIN(db->db_size - bufoff, PAGESIZE);
va = zfs_map_page(m, &sf);
- bcopy((char *)db->db_data + bufoff, va, tocpy);
+ memcpy(va, (char *)db->db_data + bufoff, tocpy);
if (tocpy < PAGESIZE) {
ASSERT3S(i, ==, *rahead - 1);
ASSERT3U((db->db_size & PAGE_MASK), !=, 0);
- bzero(va + tocpy, PAGESIZE - tocpy);
+ memset(va + tocpy, 0, PAGESIZE - tocpy);
}
zfs_unmap_page(sf);
vm_page_valid(m);
diff --git a/module/os/freebsd/zfs/hkdf.c b/module/os/freebsd/zfs/hkdf.c
index ad5d67541ad2..3a3c426fa48a 100644
--- a/module/os/freebsd/zfs/hkdf.c
+++ b/module/os/freebsd/zfs/hkdf.c
@@ -63,7 +63,7 @@ hkdf_sha512_expand(uint8_t *extract_key, uint8_t *info, uint_t info_len,
crypto_mac_update(&ctx, info, info_len);
crypto_mac_update(&ctx, &c, 1);
crypto_mac_final(&ctx, T, SHA512_DIGEST_LENGTH);
- bcopy(T, out_buf + pos,
+ memcpy(out_buf + pos, T,
(i != N) ? SHA512_DIGEST_LENGTH : (out_len - pos));
pos += SHA512_DIGEST_LENGTH;
}
diff --git a/module/os/freebsd/zfs/zfs_acl.c b/module/os/freebsd/zfs/zfs_acl.c
index c0aa6732717c..aec8cb02d62b 100644
--- a/module/os/freebsd/zfs/zfs_acl.c
+++ b/module/os/freebsd/zfs/zfs_acl.c
@@ -689,10 +689,10 @@ zfs_copy_ace_2_fuid(zfsvfs_t *zfsvfs, vtype_t obj_type, 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;
@@ -739,11 +739,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;
@@ -1094,7 +1094,7 @@ zfs_acl_node_read(znode_t *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 {
@@ -1282,7 +1282,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;
}
@@ -1564,7 +1564,7 @@ zfs_acl_inherit(zfsvfs_t *zfsvfs, vtype_t vtype, zfs_acl_t *paclp,
if ((data1sz = paclp->z_ops->ace_data(pacep, &data1)) != 0) {
data2sz = aclp->z_ops->ace_data(acep, &data2);
VERIFY3U(data2sz, ==, data1sz);
- bcopy(data1, data2, data2sz);
+ memcpy(data2, data1, data2sz);
}
aclp->z_acl_count++;
@@ -1633,7 +1633,7 @@ zfs_acl_ids_create(znode_t *dzp, int flag, vattr_t *vap, cred_t *cr,
ASSERT_VOP_ELOCKED(ZTOV(dzp), __func__);
} else
ASSERT3P(dzp->z_vnode, ==, NULL);
- bzero(acl_ids, sizeof (zfs_acl_ids_t));
+ memset(acl_ids, 0, sizeof (zfs_acl_ids_t));
acl_ids->z_mode = MAKEIMODE(vap->va_type, vap->va_mode);
if (vsecp)
@@ -1847,7 +1847,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/freebsd/zfs/zfs_ctldir.c b/module/os/freebsd/zfs/zfs_ctldir.c
index 6692e7b317ba..4db5cb583327 100644
--- a/module/os/freebsd/zfs/zfs_ctldir.c
+++ b/module/os/freebsd/zfs/zfs_ctldir.c
@@ -721,7 +721,7 @@ zfsctl_root_vptocnp(struct vop_vptocnp_args *ap)
VOP_UNLOCK1(dvp);
*ap->a_vpp = dvp;
*ap->a_buflen -= sizeof (dotzfs_name);
- bcopy(dotzfs_name, ap->a_buf + *ap->a_buflen, sizeof (dotzfs_name));
+ memcpy(ap->a_buf + *ap->a_buflen, dotzfs_name, sizeof (dotzfs_name));
return (0);
}
@@ -1214,7 +1214,7 @@ zfsctl_snapshot_vptocnp(struct vop_vptocnp_args *ap)
VOP_UNLOCK1(dvp);
*ap->a_vpp = dvp;
*ap->a_buflen -= len;
- bcopy(node->sn_name, ap->a_buf + *ap->a_buflen, len);
+ memcpy(ap->a_buf + *ap->a_buflen, node->sn_name, len);
}
vfs_unbusy(mp);
#if __FreeBSD_version >= 1300045
diff --git a/module/os/freebsd/zfs/zfs_vnops_os.c b/module/os/freebsd/zfs/zfs_vnops_os.c
index 21d121a15846..256f495eca58 100644
--- a/module/os/freebsd/zfs/zfs_vnops_os.c
+++ b/module/os/freebsd/zfs/zfs_vnops_os.c
@@ -539,7 +539,7 @@ mappedread_sf(znode_t *zp, int nbytes, zfs_uio_t *uio)
error = dmu_read(os, zp->z_id, start, bytes, va,
DMU_READ_PREFETCH);
if (bytes != PAGESIZE && error == 0)
- bzero(va + bytes, PAGESIZE - bytes);
+ memset(va + bytes, 0, PAGESIZE - bytes);
zfs_unmap_page(sf);
zfs_vmobject_wlock_12(obj);
#if __FreeBSD_version >= 1300081
@@ -5273,7 +5273,7 @@ zfs_create_attrname(int attrnamespace, const char *name, char *attrname,
{
const char *namespace, *prefix, *suffix;
- bzero(attrname, size);
+ memset(attrname, 0, size);
switch (attrnamespace) {
case EXTATTR_NAMESPACE_USER:
@@ -6142,7 +6142,7 @@ zfs_vptocnp(struct vop_vptocnp_args *ap)
}
if (error == 0) {
*ap->a_buflen -= len;
- bcopy(name, ap->a_buf + *ap->a_buflen, len);
+ memcpy(ap->a_buf + *ap->a_buflen, name, len);
*ap->a_vpp = ZTOV(dzp);
}
ZFS_EXIT(zfsvfs);
diff --git a/module/os/freebsd/zfs/zfs_znode.c b/module/os/freebsd/zfs/zfs_znode.c
index c9efdfc5b267..fe73d2af4918 100644
--- a/module/os/freebsd/zfs/zfs_znode.c
+++ b/module/os/freebsd/zfs/zfs_znode.c
@@ -1975,7 +1975,7 @@ zfs_obj_to_path_impl(objset_t *osp, uint64_t obj, sa_handle_t *hdl,
complen = strlen(component);
path -= complen;
ASSERT3P(path, >=, buf);
- bcopy(component, path, complen);
+ memcpy(path, component, complen);
obj = pobj;
if (sa_hdl != hdl) {
diff --git a/module/os/freebsd/zfs/zio_crypt.c b/module/os/freebsd/zfs/zio_crypt.c
index a50b8058a945..0410ddd65a5c 100644
--- a/module/os/freebsd/zfs/zio_crypt.c
+++ b/module/os/freebsd/zfs/zio_crypt.c
@@ -211,10 +211,10 @@ zio_crypt_key_destroy_early(zio_crypt_key_t *key)
rw_destroy(&key->zk_salt_lock);
/* free crypto templates */
- bzero(&key->zk_session, sizeof (key->zk_session));
+ memset(&key->zk_session, 0, sizeof (key->zk_session));
/* zero out sensitive data */
- bzero(key, sizeof (zio_crypt_key_t));
+ memset(key, 0, sizeof (zio_crypt_key_t));
}
void
@@ -242,7 +242,7 @@ zio_crypt_key_init(uint64_t crypt, zio_crypt_key_t *key)
return (ENOTSUP);
keydata_len = zio_crypt_table[crypt].ci_keylen;
- bzero(key, sizeof (zio_crypt_key_t));
+ memset(key, 0, sizeof (zio_crypt_key_t));
rw_init(&key->zk_salt_lock, NULL, RW_DEFAULT, NULL);
/* fill keydata buffers and salt with random data */
@@ -324,7 +324,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;
freebsd_crypt_freesession(&key->zk_session);
@@ -352,7 +352,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);
@@ -450,9 +450,8 @@ zio_crypt_key_wrap(crypto_key_t *cwkey, zio_crypt_key_t *key, uint8_t *iv,
* the plain text (source) to the cipher buffer (dest).
* We set iovecs[0] -- the authentication data -- below.
*/
- bcopy((void*)key->zk_master_keydata, keydata_out, keydata_len);
- bcopy((void*)key->zk_hmac_keydata, hmac_keydata_out,
- SHA512_HMAC_KEYLEN);
+ memcpy(keydata_out, key->zk_master_keydata, keydata_len);
+ memcpy(hmac_keydata_out, key->zk_hmac_keydata, SHA512_HMAC_KEYLEN);
iovecs[1].iov_base = keydata_out;
iovecs[1].iov_len = keydata_len;
iovecs[2].iov_base = hmac_keydata_out;
@@ -529,12 +528,11 @@ zio_crypt_key_unwrap(crypto_key_t *cwkey, uint64_t crypt, uint64_t version,
*/
dst = key->zk_master_keydata;
src = keydata;
-
- bcopy(src, dst, keydata_len);
+ memcpy(dst, src, keydata_len);
dst = key->zk_hmac_keydata;
src = hmac_keydata;
- bcopy(src, dst, SHA512_HMAC_KEYLEN);
+ memcpy(dst, src, SHA512_HMAC_KEYLEN);
iovecs[1].iov_base = key->zk_master_keydata;
iovecs[1].iov_len = keydata_len;
@@ -618,7 +616,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);
}
@@ -633,7 +631,7 @@ zio_crypt_do_hmac(zio_crypt_key_t *key, uint8_t *data, uint_t datalen,
crypto_mac(&key->zk_hmac_key, data, datalen,
raw_digestbuf, SHA512_DIGEST_LENGTH);
- bcopy(raw_digestbuf, digestbuf, digestlen);
+ memcpy(digestbuf, raw_digestbuf, digestlen);
return (0);
}
@@ -650,8 +648,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);
}
@@ -674,18 +672,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));
}
}
@@ -700,26 +698,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));
}
}
@@ -732,14 +730,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);
}
}
@@ -753,20 +751,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));
}
}
@@ -775,8 +773,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));
}
@@ -790,8 +788,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));
}
@@ -818,7 +816,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));
}
}
@@ -946,7 +944,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;
}
@@ -961,7 +959,7 @@ zio_crypt_do_dnode_hmac_updates(crypto_context_t ctx, uint64_t version,
uint8_t tmp_dncore[offsetof(dnode_phys_t, dn_blkptr)];
/* authenticate the core dnode (masking out non-portable bits) */
- bcopy(dnp, tmp_dncore, sizeof (tmp_dncore));
+ memcpy(tmp_dncore, dnp, sizeof (tmp_dncore));
adnp = (dnode_phys_t *)tmp_dncore;
if (le_bswap) {
adnp->dn_datablkszsec = BSWAP_16(adnp->dn_datablkszsec);
@@ -1057,7 +1055,7 @@ zio_crypt_do_objset_hmacs(zio_crypt_key_t *key, void *data, uint_t datalen,
crypto_mac_final(ctx, raw_portable_mac, SHA512_DIGEST_LENGTH);
- 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
@@ -1086,7 +1084,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);
}
@@ -1129,13 +1127,13 @@ zio_crypt_do_objset_hmacs(zio_crypt_key_t *key, void *data, uint_t datalen,
crypto_mac_final(ctx, raw_local_mac, SHA512_DIGEST_LENGTH);
- 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);
}
@@ -1172,11 +1170,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) {
#ifdef FCRYPTO_DEBUG
printf("%s(%d): Setting ECKSUM\n", __FUNCTION__, __LINE__);
#endif
@@ -1264,7 +1262,7 @@ zio_crypt_init_uios_zil(boolean_t encrypt, uint8_t *plainbuf,
src = cipherbuf;
dst = plainbuf;
}
- bcopy(src, dst, datalen);
+ memcpy(dst, src, datalen);
/* Find the start and end record of the log block. */
zilc = (zil_chain_t *)src;
@@ -1303,7 +1301,7 @@ 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, aadp, sizeof (zil_chain_t) - sizeof (zio_eck_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);
@@ -1329,8 +1327,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);
@@ -1347,11 +1345,12 @@ zio_crypt_init_uios_zil(boolean_t encrypt, uint8_t *plainbuf,
dst_iovecs[vec].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);
vec++;
@@ -1419,7 +1418,7 @@ zio_crypt_init_uios_dnode(boolean_t encrypt, uint64_t version,
src = cipherbuf;
dst = plainbuf;
}
- bcopy(src, dst, datalen);
+ memcpy(dst, src, datalen);
sdnp = (dnode_phys_t *)src;
ddnp = (dnode_phys_t *)dst;
@@ -1462,10 +1461,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));
}
@@ -1480,7 +1480,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;
@@ -1517,8 +1517,8 @@ zio_crypt_init_uios_dnode(boolean_t encrypt, uint64_t version,
vec++;
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;
}
@@ -1561,7 +1561,7 @@ zio_crypt_init_uios_normal(boolean_t encrypt, uint8_t *plainbuf,
ret = SET_ERROR(ENOMEM);
goto error;
}
- bzero(cipher_iovecs, nr_cipher * sizeof (iovec_t));
+ memset(cipher_iovecs, 0, nr_cipher * sizeof (iovec_t));
if (encrypt) {
src = plainbuf;
@@ -1570,7 +1570,7 @@ zio_crypt_init_uios_normal(boolean_t encrypt, uint8_t *plainbuf,
src = cipherbuf;
dst = plainbuf;
}
- bcopy(src, dst, datalen);
+ memcpy(dst, src, datalen);
cipher_iovecs[0].iov_base = dst;
cipher_iovecs[0].iov_len = datalen;
@@ -1678,8 +1678,8 @@ zio_do_crypt_data(boolean_t encrypt, zio_crypt_key_t *key,
zfs_uio_init(&puio, &puio_s);
zfs_uio_init(&cuio, &cuio_s);
- bzero(GET_UIO_STRUCT(&puio), sizeof (struct uio));
- bzero(GET_UIO_STRUCT(&cuio), sizeof (struct uio));
+ memset(GET_UIO_STRUCT(&puio), 0, sizeof (struct uio));
+ memset(GET_UIO_STRUCT(&cuio), 0, sizeof (struct uio));
#ifdef FCRYPTO_DEBUG
printf("%s(%s, %p, %p, %d, %p, %p, %u, %s, %p, %p, %p)\n",
@@ -1710,7 +1710,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_session;
} else {
@@ -1741,7 +1741,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);
@@ -1753,14 +1753,14 @@ error:
kmem_free(failed_decrypt_buf, failed_decrypt_size);
failed_decrypt_buf = kmem_alloc(datalen, KM_SLEEP);
failed_decrypt_size = datalen;
- bcopy(cipherbuf, failed_decrypt_buf, datalen);
+ memcpy(failed_decrypt_buf, cipherbuf, datalen);
}
if (locked)
rw_exit(&key->zk_salt_lock);
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);
return (SET_ERROR(ret));
diff --git a/module/os/linux/spl/spl-generic.c b/module/os/linux/spl/spl-generic.c
index 5bf2f6912457..bf83d2fc23ac 100644
--- a/module/os/linux/spl/spl-generic.c
+++ b/module/os/linux/spl/spl-generic.c
@@ -771,7 +771,6 @@ spl_init(void)
{
int rc = 0;
- bzero(&p0, sizeof (proc_t));
spl_random_init();
if ((rc = spl_kvmem_init()))
diff --git a/module/os/linux/zfs/qat_crypt.c b/module/os/linux/zfs/qat_crypt.c
index 4771b2f3bec5..18b6e38d1a6e 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 1859ecd9913b..351e4dad799c 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 82b32d1cc3fa..c5b3b5ce7fc0 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 a3d5d5f83b6f..1b315c27016d 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 412af0e88931..81a059651e8a 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 d65d75312828..b76e65d16822 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 099d23484d32..dcab02b07894 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);