From fb823de9fb086a43e6618abe93e540d6f8865c32 Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Mon, 17 Oct 2022 02:20:21 -0400 Subject: [PATCH] Cleanup: Delete dead code from send_merge_thread() 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 Signed-off-by: Richard Yao Closes #14042 --- module/zfs/dmu_send.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/module/zfs/dmu_send.c b/module/zfs/dmu_send.c index 4ee3ffc35..ceef87a30 100644 --- a/module/zfs/dmu_send.c +++ b/module/zfs/dmu_send.c @@ -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();