diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libefi/rdwr_efi.c | 13 | ||||
-rw-r--r-- | lib/libnvpair/libnvpair_json.c | 4 | ||||
-rw-r--r-- | lib/libspl/include/sys/kstat.h | 10 | ||||
-rw-r--r-- | lib/libzfs/libzfs_crypto.c | 2 | ||||
-rw-r--r-- | lib/libzfs/libzfs_pool.c | 3 | ||||
-rw-r--r-- | lib/libzfs/libzfs_sendrecv.c | 8 | ||||
-rw-r--r-- | lib/libzfs/libzfs_util.c | 2 | ||||
-rw-r--r-- | lib/libzfs/os/freebsd/libzfs_compat.c | 6 |
8 files changed, 21 insertions, 27 deletions
diff --git a/lib/libefi/rdwr_efi.c b/lib/libefi/rdwr_efi.c index b4fec0c86..e32c45131 100644 --- a/lib/libefi/rdwr_efi.c +++ b/lib/libefi/rdwr_efi.c @@ -865,7 +865,7 @@ efi_read(int fd, struct dk_gpt *vtoc) j < sizeof (conversion_array) / sizeof (struct uuid_to_ptag); j++) { - if (bcmp(&vtoc->efi_parts[i].p_guid, + if (memcmp(&vtoc->efi_parts[i].p_guid, &conversion_array[j].uuid, sizeof (struct uuid)) == 0) { vtoc->efi_parts[i].p_tag = j; @@ -920,18 +920,17 @@ write_pmbr(int fd, struct dk_gpt *vtoc) /* LINTED -- always longlong aligned */ dk_ioc.dki_data = (efi_gpt_t *)buf; if (efi_ioctl(fd, DKIOCGETEFI, &dk_ioc) == -1) { - (void) memcpy(&mb, buf, sizeof (mb)); - bzero(&mb, sizeof (mb)); + memset(&mb, 0, sizeof (mb)); mb.signature = LE_16(MBB_MAGIC); } else { (void) memcpy(&mb, buf, sizeof (mb)); if (mb.signature != LE_16(MBB_MAGIC)) { - bzero(&mb, sizeof (mb)); + memset(&mb, 0, sizeof (mb)); mb.signature = LE_16(MBB_MAGIC); } } - bzero(&mb.parts, sizeof (mb.parts)); + memset(&mb.parts, 0, sizeof (mb.parts)); cp = (uchar_t *)&mb.parts[0]; /* bootable or not */ *cp++ = 0; @@ -1455,8 +1454,8 @@ efi_write(int fd, struct dk_gpt *vtoc) (void) uuid_generate((uchar_t *) &vtoc->efi_parts[i].p_uguid); } - bcopy(&vtoc->efi_parts[i].p_uguid, - &efi_parts[i].efi_gpe_UniquePartitionGUID, + memcpy(&efi_parts[i].efi_gpe_UniquePartitionGUID, + &vtoc->efi_parts[i].p_uguid, sizeof (uuid_t)); } efi->efi_gpt_PartitionEntryArrayCRC32 = diff --git a/lib/libnvpair/libnvpair_json.c b/lib/libnvpair/libnvpair_json.c index 15b6f4afa..b27f7e4f6 100644 --- a/lib/libnvpair/libnvpair_json.c +++ b/lib/libnvpair/libnvpair_json.c @@ -46,12 +46,10 @@ static int nvlist_print_json_string(FILE *fp, const char *input) { - mbstate_t mbr; + mbstate_t mbr = {0}; wchar_t c; size_t sz; - bzero(&mbr, sizeof (mbr)); - FPRINTF(fp, "\""); while ((sz = mbrtowc(&c, input, MB_CUR_MAX, &mbr)) > 0) { if (sz == (size_t)-1 || sz == (size_t)-2) { diff --git a/lib/libspl/include/sys/kstat.h b/lib/libspl/include/sys/kstat.h index f73fb92eb..7f9aa6d8d 100644 --- a/lib/libspl/include/sys/kstat.h +++ b/lib/libspl/include/sys/kstat.h @@ -383,9 +383,9 @@ typedef struct kstat32 { * * ksp->ks_snaptime = gethrtime(); * if (rw == KSTAT_WRITE) - * bcopy(buf, ksp->ks_data, ksp->ks_data_size); + * memcpy(ksp->ks_data, buf, ksp->ks_data_size); * else - * bcopy(ksp->ks_data, buf, ksp->ks_data_size); + * memcpy(buf, ksp->ks_data, ksp->ks_data_size); * return (0); * * A more illuminating example is taking a snapshot of a linked list: @@ -394,7 +394,7 @@ typedef struct kstat32 { * if (rw == KSTAT_WRITE) * return (EACCES); ... See below ... * for (foo = first_foo; foo; foo = foo->next) { - * bcopy((char *) foo, (char *) buf, sizeof (struct foo)); + * memcpy(buf, foo, sizeof (struct foo)); * buf = ((struct foo *) buf) + 1; * } * return (0); @@ -423,12 +423,12 @@ typedef struct kstat32 { * uint_t i; * * ... Do the regular copy ... - * bcopy(ksp->ks_data, buf, sizeof (kstat_named_t) * ksp->ks_ndata); + * memcpy(buf, ksp->ks_data, sizeof (kstat_named_t) * ksp->ks_ndata); * * for (i = 0; i < ksp->ks_ndata; i++, knp++) { * if (knp[i].data_type == KSTAT_DATA_STRING && * KSTAT_NAMED_STR_PTR(knp) != NULL) { - * bcopy(KSTAT_NAMED_STR_PTR(knp), end, + * memcpy(end, KSTAT_NAMED_STR_PTR(knp), * KSTAT_NAMED_STR_BUFLEN(knp)); * KSTAT_NAMED_STR_PTR(knp) = end; * end += KSTAT_NAMED_STR_BUFLEN(knp); diff --git a/lib/libzfs/libzfs_crypto.c b/lib/libzfs/libzfs_crypto.c index 777ef21a5..1428029a9 100644 --- a/lib/libzfs/libzfs_crypto.c +++ b/lib/libzfs/libzfs_crypto.c @@ -788,7 +788,7 @@ derive_key(libzfs_handle_t *hdl, zfs_keyformat_t format, uint64_t iters, switch (format) { case ZFS_KEYFORMAT_RAW: - bcopy(key_material, key, WRAPPING_KEY_LEN); + memcpy(key, key_material, WRAPPING_KEY_LEN); break; case ZFS_KEYFORMAT_HEX: ret = hex_key_to_raw((char *)key_material, diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index 059aa7adb..a65a9b645 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -3931,14 +3931,13 @@ zpool_vdev_remove(zpool_handle_t *zhp, const char *path) int zpool_vdev_remove_cancel(zpool_handle_t *zhp) { - zfs_cmd_t zc; + zfs_cmd_t zc = {{0}}; char msg[1024]; libzfs_handle_t *hdl = zhp->zpool_hdl; (void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN, "cannot cancel removal")); - bzero(&zc, sizeof (zc)); (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name)); zc.zc_cookie = 1; diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c index ba6eddd12..2d866dfa7 100644 --- a/lib/libzfs/libzfs_sendrecv.c +++ b/lib/libzfs/libzfs_sendrecv.c @@ -4285,9 +4285,9 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap, boolean_t recursive; char *snapname = NULL; char destsnap[MAXPATHLEN * 2]; - char origin[MAXNAMELEN]; + char origin[MAXNAMELEN] = {0}; char name[MAXPATHLEN]; - char tmp_keylocation[MAXNAMELEN]; + char tmp_keylocation[MAXNAMELEN] = {0}; nvlist_t *rcvprops = NULL; /* props received from the send stream */ nvlist_t *oxprops = NULL; /* override (-o) and exclude (-x) props */ nvlist_t *origprops = NULL; /* original props (if destination exists) */ @@ -4303,8 +4303,6 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap, #define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC #endif clock_gettime(CLOCK_MONOTONIC_RAW, &begin_time); - bzero(origin, MAXNAMELEN); - bzero(tmp_keylocation, MAXNAMELEN); (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot receive")); @@ -5228,7 +5226,7 @@ zfs_receive_impl(libzfs_handle_t *hdl, const char *tosnap, * We computed the checksum in the wrong byteorder in * recv_read() above; do it again correctly. */ - bzero(&zcksum, sizeof (zio_cksum_t)); + memset(&zcksum, 0, sizeof (zio_cksum_t)); fletcher_4_incremental_byteswap(&drr, sizeof (drr), &zcksum); flags->byteswap = B_TRUE; diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index 7ed03d182..7748ed72c 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -807,7 +807,7 @@ zfs_realloc(libzfs_handle_t *hdl, void *ptr, size_t oldsize, size_t newsize) return (NULL); } - bzero((char *)ret + oldsize, (newsize - oldsize)); + memset((char *)ret + oldsize, 0, newsize - oldsize); return (ret); } diff --git a/lib/libzfs/os/freebsd/libzfs_compat.c b/lib/libzfs/os/freebsd/libzfs_compat.c index f5be2b90b..a4b30df85 100644 --- a/lib/libzfs/os/freebsd/libzfs_compat.c +++ b/lib/libzfs/os/freebsd/libzfs_compat.c @@ -103,9 +103,9 @@ execvPe(const char *name, const char *path, char * const *argv, 16); continue; } - bcopy(p, buf, lp); + memcpy(buf, p, lp); buf[lp] = '/'; - bcopy(name, buf + lp + 1, ln); + memcpy(buf + lp + 1, name, ln); buf[lp + ln + 1] = '\0'; retry: (void) execve(bp, argv, envp); @@ -135,7 +135,7 @@ retry: (void) execve(bp, argv, envp); if (cnt > 0) { memp[0] = argv[0]; memp[1] = bp; - bcopy(argv + 1, memp + 2, + memcpy(memp + 2, argv + 1, cnt * sizeof (char *)); } else { memp[0] = "sh"; |