From: "Sungjong Seo" <sj1557.seo@samsung.com>
To: "'hyeongseok.kim'" <hyeongseok@gmail.com>, <namjae.jeon@samsung.com>
Cc: <linux-fsdevel@vger.kernel.org>
Subject: RE: [PATCH] exfat: fix range validation error in alloc and free cluster
Date: Thu, 4 Jun 2020 17:50:54 +0900 [thread overview]
Message-ID: <3b5501d63a4d$4213b950$c63b2bf0$@samsung.com> (raw)
In-Reply-To: <1591246468-32426-1-git-send-email-hyeongseok@gmail.com>
> There is check error in range condition that can never be entered even
> with invalid input.
> Replace incorrent checking code with already existing valid checker.
>
> Signed-off-by: hyeongseok.kim <hyeongseok@gmail.com>
Acked-by: Sungjong Seo <sj1557.seo@samsung.com>
Looks good. Thank you!
> ---
> fs/exfat/fatent.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/exfat/fatent.c b/fs/exfat/fatent.c index 267e5e0..4e5c5c9
> 100644
> --- a/fs/exfat/fatent.c
> +++ b/fs/exfat/fatent.c
> @@ -169,7 +169,7 @@ int exfat_free_cluster(struct inode *inode, struct
> exfat_chain *p_chain)
> return 0;
>
> /* check cluster validation */
> - if (p_chain->dir < 2 && p_chain->dir >= sbi->num_clusters) {
> + if (!is_valid_cluster(sbi, p_chain->dir)) {
> exfat_err(sb, "invalid start cluster (%u)", p_chain->dir);
> return -EIO;
> }
> @@ -346,7 +346,7 @@ int exfat_alloc_cluster(struct inode *inode, unsigned
> int num_alloc,
> }
>
> /* check cluster validation */
> - if (hint_clu < EXFAT_FIRST_CLUSTER && hint_clu >= sbi->num_clusters)
> {
> + if (!is_valid_cluster(sbi, hint_clu)) {
> exfat_err(sb, "hint_cluster is invalid (%u)",
> hint_clu);
> hint_clu = EXFAT_FIRST_CLUSTER;
> --
> 2.7.4
next prev parent reply other threads:[~2020-06-04 8:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20200604045437epcas1p17180ef9b61d8ff1d4877c49755e766a2@epcas1p1.samsung.com>
2020-06-04 4:54 ` [PATCH] exfat: fix range validation error in alloc and free cluster hyeongseok.kim
2020-06-04 8:50 ` Sungjong Seo [this message]
2020-06-05 7:53 ` Namjae Jeon
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='3b5501d63a4d$4213b950$c63b2bf0$@samsung.com' \
--to=sj1557.seo@samsung.com \
--cc=hyeongseok@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=namjae.jeon@samsung.com \
/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;
as well as URLs for NNTP newsgroup(s).