Initialize ref_blkno output at the start of block_dirty_ref()

scoutfs_block_dirty_ref() only sets *ref_blkno on the path that
allocates a new cow block. The early return paths leave it untouched,
so a caller that reads it back gets whatever value was on the stack.

This is harmless with the current callers. dirty_alloc_blocks() bails
out before calling here when the blocks are already dirty, so the
early return on an already-dirty block is never reached, and the
error paths return a negative value that callers check before using
ref_blkno.

Signed-off-by: Auke Kok <auke.kok@versity.com>
This commit is contained in:
Auke Kok
2026-04-15 12:06:42 -07:00
parent fab589700e
commit c9d442c406
+3
View File
@@ -836,6 +836,9 @@ int scoutfs_block_dirty_ref(struct super_block *sb, struct scoutfs_alloc *alloc,
int ret;
int err;
if (ref_blkno)
*ref_blkno = 0;
/* read existing referenced block, if any */
blkno = le64_to_cpu(ref->blkno);
if (blkno) {