From: Zhihao Cheng <chengzhihao1@huawei.com>
To: Yuta Hayama <hayama@lineo.co.jp>, <linux-mtd@lists.infradead.org>
Subject: Re: [PATCH mtd-utils 1/2] fsck.ubifs: don't use pointers that reference out-of-scope variables
Date: Fri, 14 Nov 2025 11:15:15 +0800 [thread overview]
Message-ID: <bcb5c4f2-e017-d6b7-a0fc-1c5dd51d08ec@huawei.com> (raw)
In-Reply-To: <0828e7c7-c036-49ad-9019-8f94b6a87c27@lineo.co.jp>
在 2025/11/13 16:31, Yuta Hayama 写道:
> 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>
> ---
> ubifs-utils/fsck.ubifs/check_files.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
Thanks for fixing it.
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
> 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);
>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2025-11-14 3:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-13 8:29 [PATCH mtd-utils 0/2] mtd-utils: fsck.ubifs: fixes several undefined behaviors Yuta Hayama
2025-11-13 8:31 ` [PATCH mtd-utils 1/2] fsck.ubifs: don't use pointers that reference out-of-scope variables Yuta Hayama
2025-11-14 3:15 ` Zhihao Cheng [this message]
2025-11-13 8:32 ` [PATCH mtd-utils 2/2] fsck.ubifs: use the appropriate format specifiers for ino_t and loff_t Yuta Hayama
2025-11-14 8:54 ` Zhihao Cheng
2026-02-13 13:55 ` [mtd-utils,v2,2/2] fsck.ubifs: fix platform dependant ino_t and loff_t formatting Tomas Alvarez Vanoli
2026-02-14 1:33 ` Zhihao Cheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bcb5c4f2-e017-d6b7-a0fc-1c5dd51d08ec@huawei.com \
--to=chengzhihao1@huawei.com \
--cc=hayama@lineo.co.jp \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox