From a75782ee97eb5940c865fd560d846b9a93ed9122 Mon Sep 17 00:00:00 2001 From: Yuta Hayama Date: Thu, 13 Nov 2025 17:31:32 +0900 Subject: fsck.ubifs: don't use pointers that reference out-of-scope variables sn is a reference to either an ino_node, dent_node, or data_node. When sn is actually used in calls to dbg_fsck() or insert_or_update_file(), these variables must not be out of scope. Signed-off-by: Yuta Hayama Reviewed-by: Zhihao Cheng Signed-off-by: David Oberhollenzer --- ubifs-utils/fsck.ubifs/check_files.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'ubifs-utils/fsck.ubifs/check_files.c') diff --git a/ubifs-utils/fsck.ubifs/check_files.c b/ubifs-utils/fsck.ubifs/check_files.c index 1e1a77b..54300a3 100644 --- a/ubifs-utils/fsck.ubifs/check_files.c +++ b/ubifs-utils/fsck.ubifs/check_files.c @@ -57,12 +57,13 @@ static int construct_file(struct ubifs_info *c, union ubifs_key *key, struct rb_root *tree = &FSCK(c)->scanned_files; struct scanned_node *sn = NULL; struct ubifs_ch *ch = (struct ubifs_ch *)node; + struct scanned_ino_node ino_node; + struct scanned_dent_node dent_node; + struct scanned_data_node data_node; switch (ch->node_type) { case UBIFS_INO_NODE: { - struct scanned_ino_node ino_node; - if (!parse_ino_node(c, lnum, offs, node, key, &ino_node)) { if (fix_problem(c, INVALID_INO_NODE, NULL)) return add_invalid_node(c, key, lnum, offs, iter); @@ -74,8 +75,6 @@ static int construct_file(struct ubifs_info *c, union ubifs_key *key, case UBIFS_DENT_NODE: case UBIFS_XENT_NODE: { - struct scanned_dent_node dent_node; - if (!parse_dent_node(c, lnum, offs, node, key, &dent_node)) { if (fix_problem(c, INVALID_DENT_NODE, NULL)) return add_invalid_node(c, key, lnum, offs, iter); @@ -86,8 +85,6 @@ static int construct_file(struct ubifs_info *c, union ubifs_key *key, } case UBIFS_DATA_NODE: { - struct scanned_data_node data_node; - if (!parse_data_node(c, lnum, offs, node, key, &data_node)) { if (fix_problem(c, INVALID_DATA_NODE, NULL)) return add_invalid_node(c, key, lnum, offs, iter); -- cgit v1.2.3