From: Zhihao Cheng <chengzhihao1@huawei.com>
To: Markus Elfring <Markus.Elfring@web.de>,
<linux-mtd@lists.infradead.org>,
Richard Weinberger <richard@nod.at>
Cc: LKML <linux-kernel@vger.kernel.org>, <kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH 1/2] ubifs: Call iput(xino) only once in ubifs_purge_xattrs()
Date: Thu, 26 Sep 2024 19:12:51 +0800 [thread overview]
Message-ID: <002d1dee-0e34-279d-c2e6-3d0fdfa385af@huawei.com> (raw)
In-Reply-To: <c5bd9bb7-2636-4c48-9623-4c93ded3469c@web.de>
在 2024/9/26 17:49, Markus Elfring 写道:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 26 Sep 2024 11:05:29 +0200
>
> An iput(xino) call was immediately used after a return value check
> for a remove_xattr() call in this function implementation.
> Thus call such a function only once instead directly before the check.
>
> This issue was transformed by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> fs/ubifs/xattr.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
> diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
> index f734588b224a..7757959e9f09 100644
> --- a/fs/ubifs/xattr.c
> +++ b/fs/ubifs/xattr.c
> @@ -541,16 +541,14 @@ int ubifs_purge_xattrs(struct inode *host)
>
> clear_nlink(xino);
> err = remove_xattr(c, host, xino, &nm);
> + iput(xino);
> if (err) {
> kfree(pxent);
> kfree(xent);
> - iput(xino);
> ubifs_err(c, "cannot remove xattr, error %d", err);
> goto out_err;
> }
>
> - iput(xino);
> -
> kfree(pxent);
> pxent = xent;
> key_read(c, &xent->key, &key);
> --
> 2.46.1
>
> .
>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2024-09-26 11:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-26 9:48 [PATCH 0/2] ubifs: Adjustments for ubifs_purge_xattrs() Markus Elfring
2024-09-26 9:49 ` [PATCH 1/2] ubifs: Call iput(xino) only once in ubifs_purge_xattrs() Markus Elfring
2024-09-26 11:12 ` Zhihao Cheng [this message]
2024-09-26 9:50 ` [PATCH 2/2] ubifs: Reduce kfree() calls " Markus Elfring
2024-09-26 11:13 ` 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=002d1dee-0e34-279d-c2e6-3d0fdfa385af@huawei.com \
--to=chengzhihao1@huawei.com \
--cc=Markus.Elfring@web.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
/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