Skip to content

Commit

Permalink
Cleanup: Delete dead code from send_merge_thread()
Browse files Browse the repository at this point in the history
range is always deferenced before it reaches this check, such that the
kmem_zalloc() call is never executed.

There is also no need to set `range->eos_marker = B_TRUE` because it is
already set.

Coverity incorrectly complained about a potential NULL pointer
dereference because of this.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes openzfs#14042
  • Loading branch information
ryao authored and behlendorf committed Oct 18, 2022
1 parent 717641a commit fb823de
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions module/zfs/dmu_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -1586,9 +1586,8 @@ 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;
ASSERT3P(range, !=, NULL);
ASSERT3S(range->eos_marker, ==, B_TRUE);
bqueue_enqueue_flush(&smt_arg->q, range, 1);
spl_fstrans_unmark(cookie);
thread_exit();
Expand Down

0 comments on commit fb823de

Please sign in to comment.