git: 698e0c419895 - stable/15 - zvol: Fix uses of uninitialized variables in zvol_rename_minors_impl()

Mark Johnston <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a67966e.25d26.67a34039__5554.65168306313$1785173642$gmane$org@gitrepo.freebsd.org>
The branch stable/15 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=698e0c419895da2d0d12c5f4d61d85a1d91b6b9d

commit 698e0c419895da2d0d12c5f4d61d85a1d91b6b9d
Author:     Mark Johnston <[email protected]>
AuthorDate: 2026-02-12 22:10:36 +0000
Commit:     Mark Johnston <[email protected]>
CommitDate: 2026-07-27 17:29:04 +0000

    zvol: Fix uses of uninitialized variables in zvol_rename_minors_impl()
    
    Reported-by: GitHub Copilot
    Reviewed-by: Brian Behlendorf <[email protected]>
    Reviewed-by: Alexander Motin <[email protected]>
    Signed-off-by: Mark Johnston <[email protected]>
    Closes #18191
    (cherry picked from commit 943a05528494b2f4585541089606796476fb229e)
---
 sys/contrib/openzfs/module/zfs/zvol.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/contrib/openzfs/module/zfs/zvol.c b/sys/contrib/openzfs/module/zfs/zvol.c
index 67ba68aca83d..e1fe3eae2f27 100644
--- a/sys/contrib/openzfs/module/zfs/zvol.c
+++ b/sys/contrib/openzfs/module/zfs/zvol.c
@@ -1778,6 +1778,7 @@ zvol_rename_minors_impl(zvol_task_t *task)
 	if (zvol_inhibit_dev)
 		return;
 
+	last_error = 0;
 	oldnamelen = strlen(oldname);
 
 	rw_enter(&zvol_state_lock, RW_WRITER);
@@ -1797,6 +1798,8 @@ zvol_rename_minors_impl(zvol_task_t *task)
 			    zv->zv_name + oldnamelen + 1);
 			error = zvol_os_rename_minor(zv, name);
 			kmem_strfree(name);
+		} else {
+			error = 0;
 		}
 		if (error) {
 			last_error = error;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.