From 8532da5e20b90bed8decd22726a70c7c81ef6951 Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Wed, 16 Nov 2022 16:38:19 -0500 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. A previously version of this had erronously also pruned the `range->eos_marker = B_TRUE` line, but it must be set whenever we encounter an error or are cancelled early. Coverity incorrectly complained about a potential NULL pointer dereference because of this. Reported-by: Coverity (CID 1524550) Reviewed-by: Brian Behlendorf Reviewed-by: Ryan Moeller Signed-off-by: Richard Yao Closes #14210 --- module/zfs/dmu_send.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/module/zfs/dmu_send.c b/module/zfs/dmu_send.c index ccb7eb207..fbf19d5c3 100644 --- a/module/zfs/dmu_send.c +++ b/module/zfs/dmu_send.c @@ -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);