diff --git a/cmd/zpool/zpool_vdev.c b/cmd/zpool/zpool_vdev.c index 8db1aef76..eb81dfe07 100644 --- a/cmd/zpool/zpool_vdev.c +++ b/cmd/zpool/zpool_vdev.c @@ -1329,8 +1329,13 @@ draid_config_by_type(nvlist_t *nv, const char *type, uint64_t children) return (EINVAL); nparity = (uint64_t)get_parity(type); - if (nparity == 0) + if (nparity == 0 || nparity > VDEV_DRAID_MAXPARITY) { + fprintf(stderr, + gettext("invalid dRAID parity level %llu; must be " + "between 1 and %d\n"), (u_longlong_t)nparity, + VDEV_DRAID_MAXPARITY); return (EINVAL); + } char *p = (char *)type; while ((p = strchr(p, ':')) != NULL) { @@ -1401,14 +1406,6 @@ draid_config_by_type(nvlist_t *nv, const char *type, uint64_t children) return (EINVAL); } - if (nparity == 0 || nparity > VDEV_DRAID_MAXPARITY) { - fprintf(stderr, - gettext("invalid dRAID parity level %llu; must be " - "between 1 and %d\n"), (u_longlong_t)nparity, - VDEV_DRAID_MAXPARITY); - return (EINVAL); - } - /* * Verify the requested number of spares can be satisfied. * An arbitrary limit of 100 distributed spares is applied. diff --git a/module/zfs/dmu_redact.c b/module/zfs/dmu_redact.c index 7afcc1231..6bd35713f 100644 --- a/module/zfs/dmu_redact.c +++ b/module/zfs/dmu_redact.c @@ -746,10 +746,8 @@ perform_thread_merge(bqueue_t *q, uint32_t num_threads, bqueue_enqueue(q, record, sizeof (*record)); return (0); } - if (num_threads > 0) { - redact_nodes = kmem_zalloc(num_threads * - sizeof (*redact_nodes), KM_SLEEP); - } + redact_nodes = kmem_zalloc(num_threads * + sizeof (*redact_nodes), KM_SLEEP); avl_create(&start_tree, redact_node_compare_start, sizeof (struct redact_node), diff --git a/module/zfs/sa.c b/module/zfs/sa.c index 763b0c920..f9daaabbe 100644 --- a/module/zfs/sa.c +++ b/module/zfs/sa.c @@ -1918,7 +1918,7 @@ sa_modify_attrs(sa_handle_t *hdl, sa_attr_type_t newattr, count = bonus_attr_count; hdr = SA_GET_HDR(hdl, SA_BONUS); idx_tab = SA_IDX_TAB_GET(hdl, SA_BONUS); - for (; k != 2; k++) { + for (; ; k++) { /* * Iterate over each attribute in layout. Fetch the * size of variable-length attributes needing rewrite diff --git a/module/zfs/zap_leaf.c b/module/zfs/zap_leaf.c index 2e8489c7d..e6afb1c58 100644 --- a/module/zfs/zap_leaf.c +++ b/module/zfs/zap_leaf.c @@ -315,7 +315,7 @@ zap_leaf_array_read(zap_leaf_t *l, uint16_t chunk, struct zap_leaf_array *la = &ZAP_LEAF_CHUNK(l, chunk).l_array; ASSERT3U(chunk, <, ZAP_LEAF_NUMCHUNKS(l)); - for (int i = 0; i < ZAP_LEAF_ARRAY_BYTES && len > 0; i++) { + for (int i = 0; i < ZAP_LEAF_ARRAY_BYTES; i++) { value = (value << 8) | la->la_array[i]; byten++; if (byten == array_int_len) {