Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various Coverity patches #14210

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/zdb/zdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ static void
verify_livelist_allocs(metaslab_verify_t *mv, uint64_t txg,
uint64_t offset, uint64_t size)
{
sublivelist_verify_block_t svb;
sublivelist_verify_block_t svb = {{{0}}};
DVA_SET_VDEV(&svb.svb_dva, mv->mv_vdid);
DVA_SET_OFFSET(&svb.svb_dva, offset);
DVA_SET_ASIZE(&svb.svb_dva, size);
Expand Down
10 changes: 6 additions & 4 deletions contrib/coverity/model.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

#include <stdarg.h>

#define KM_NOSLEEP 0x0001 /* cannot block for memory; may fail */

#define UMEM_DEFAULT 0x0000 /* normal -- may fail */
#define UMEM_NOFAIL 0x0100 /* Never fails */

Expand Down Expand Up @@ -173,7 +175,7 @@ spl_kmem_alloc(size_t sz, int fl, const char *func, int line)
if (condition1)
__coverity_sleep__();

if ((fl == 0) || condition0) {
if (((fl & KM_NOSLEEP) != KM_NOSLEEP) || condition0) {
void *buf = __coverity_alloc__(sz);
__coverity_mark_as_uninitialized_buffer__(buf);
__coverity_mark_as_afm_allocated__(buf, "spl_kmem_free");
Expand All @@ -194,7 +196,7 @@ spl_kmem_zalloc(size_t sz, int fl, const char *func, int line)
if (condition1)
__coverity_sleep__();

if ((fl == 0) || condition0) {
if (((fl & KM_NOSLEEP) != KM_NOSLEEP) || condition0) {
void *buf = __coverity_alloc__(sz);
__coverity_writeall0__(buf);
__coverity_mark_as_afm_allocated__(buf, "spl_kmem_free");
Expand Down Expand Up @@ -276,7 +278,7 @@ spl_vmem_alloc(size_t sz, int fl, const char *func, int line)
if (condition1)
__coverity_sleep__();

if ((fl == 0) || condition0) {
if (((fl & KM_NOSLEEP) != KM_NOSLEEP) || condition0) {
void *buf = __coverity_alloc__(sz);
__coverity_mark_as_uninitialized_buffer__(buf);
__coverity_mark_as_afm_allocated__(buf, "spl_vmem_free");
Expand All @@ -295,7 +297,7 @@ spl_vmem_zalloc(size_t sz, int fl, const char *func, int line)
if (condition1)
__coverity_sleep__();

if ((fl == 0) || condition0) {
if (((fl & KM_NOSLEEP) != KM_NOSLEEP) || condition0) {
void *buf = __coverity_alloc__(sz);
__coverity_writeall0__(buf);
__coverity_mark_as_afm_allocated__(buf, "spl_vmem_free");
Expand Down
4 changes: 2 additions & 2 deletions module/zfs/dbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -3323,10 +3323,10 @@ dbuf_prefetch_indirect_done(zio_t *zio, const zbookmark_phys_t *zb,
blkptr_t *bp = ((blkptr_t *)abuf->b_data) +
P2PHASE(nextblkid, 1ULL << dpa->dpa_epbs);

ASSERT(!BP_IS_REDACTED(bp) ||
ASSERT(!BP_IS_REDACTED(bp) || (dpa->dpa_dnode &&
dsl_dataset_feature_is_active(
dpa->dpa_dnode->dn_objset->os_dsl_dataset,
SPA_FEATURE_REDACTED_DATASETS));
SPA_FEATURE_REDACTED_DATASETS)));
if (BP_IS_HOLE(bp) || BP_IS_REDACTED(bp)) {
arc_buf_destroy(abuf, private);
dbuf_prefetch_fini(dpa, B_TRUE);
Expand Down
2 changes: 0 additions & 2 deletions module/zfs/dmu_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -1586,8 +1586,6 @@ send_merge_thread(void *arg)
}
range_free(front_ranges[i]);
}
if (range == NULL)
range = kmem_zalloc(sizeof (*range), KM_SLEEP);
range->eos_marker = B_TRUE;
bqueue_enqueue_flush(&smt_arg->q, range, 1);
spl_fstrans_unmark(cookie);
Expand Down