mirror of
https://github.com/versity/scoutfs.git
synced 2026-07-19 14:32:32 +00:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user