From 1c212d1b7c4776a9639ce15e9c23af0f23c81f44 Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Fri, 10 Mar 2023 17:47:56 -0500 Subject: [PATCH] Fix uninitialized scalar value read regression in dmu_recv_begin() da19d919a853ad05ef300fe000e6c96c4db84bcf changed this in a way that permits execution to reach `if (err == 0)` without initializing err. This could randomly cause the sync task to not execute. We fix that by initializing err to zero. Reviewed-by: George Melikov Reviewed-by: Brian Behlendorf Reviewed-by: Rob Norris Signed-off-by: Richard Yao Reported-by: Coverity (CID-1535377) Closes #14607 --- module/zfs/dmu_recv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zfs/dmu_recv.c b/module/zfs/dmu_recv.c index 3763cba02..50378f8db 100644 --- a/module/zfs/dmu_recv.c +++ b/module/zfs/dmu_recv.c @@ -1223,7 +1223,7 @@ dmu_recv_begin(char *tofs, char *tosnap, dmu_replay_record_t *drr_begin, zfs_file_t *fp, offset_t *voffp) { dmu_recv_begin_arg_t drba = { 0 }; - int err; + int err = 0; memset(drc, 0, sizeof (dmu_recv_cookie_t)); drc->drc_drr_begin = drr_begin;