From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: <ntfs3@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
<linux-fsdevel@vger.kernel.org>,
<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH] fs/ntfs3: Don't clear upper bits accidentally in log_replay()
Date: Fri, 10 Jun 2022 19:21:28 +0300 [thread overview]
Message-ID: <01e2f814-1fcf-bc0c-b580-e3879eda85b6@paragon-software.com> (raw)
In-Reply-To: <YnjY58EpRzaZP+YC@kili>
On 5/9/22 12:03, Dan Carpenter wrote:
> The "vcn" variable is a 64 bit. The "log->clst_per_page" variable is a
> u32. This means that the mask accidentally clears out the high 32 bits
> when it was only supposed to clear some low bits. Fix this by adding a
> cast to u64.
>
> Fixes: b46acd6a6a62 ("fs/ntfs3: Add NTFS journal")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Why am I getting new Smatch warnings in old ntfs3 code? It is a mystery.
>
> fs/ntfs3/fslog.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c
> index 915f42cf07bc..0da339fda2f4 100644
> --- a/fs/ntfs3/fslog.c
> +++ b/fs/ntfs3/fslog.c
> @@ -5057,7 +5057,7 @@ int log_replay(struct ntfs_inode *ni, bool *initialized)
> goto add_allocated_vcns;
>
> vcn = le64_to_cpu(lrh->target_vcn);
> - vcn &= ~(log->clst_per_page - 1);
> + vcn &= ~(u64)(log->clst_per_page - 1);
>
> add_allocated_vcns:
> for (i = 0, vcn = le64_to_cpu(lrh->target_vcn),
Thanks for patch, applied!
prev parent reply other threads:[~2022-06-10 16:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-09 9:03 [PATCH] fs/ntfs3: Don't clear upper bits accidentally in log_replay() Dan Carpenter
2022-05-19 0:55 ` Namjae Jeon
2022-06-10 16:21 ` Konstantin Komarov [this message]
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=01e2f814-1fcf-bc0c-b580-e3879eda85b6@paragon-software.com \
--to=almaz.alexandrovich@paragon-software.com \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ntfs3@lists.linux.dev \
/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).