diff options
| author | Yuta Hayama <hayama@lineo.co.jp> | 2025-11-13 17:31:32 +0900 |
|---|---|---|
| committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2026-04-13 07:32:41 +0200 |
| commit | a75782ee97eb5940c865fd560d846b9a93ed9122 (patch) | |
| tree | 2e631c74cb79faded227ea172c10edc4a7f79799 /ubifs-utils | |
| parent | eccab61f367d24f3fc79652cc89463999b418a8e (diff) | |
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 <hayama@lineo.co.jp>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'ubifs-utils')
| -rw-r--r-- | ubifs-utils/fsck.ubifs/check_files.c | 9 |
1 files changed, 3 insertions, 6 deletions
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); |
