From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: <ntfs3@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH] fs/ntfs3: Remove a useless test
Date: Tue, 7 Jun 2022 18:58:53 +0300 [thread overview]
Message-ID: <4f66239a-2209-6375-95ad-e8be0d28cf85@paragon-software.com> (raw)
In-Reply-To: <ade97ac1a1506fd322b008bdf8c24f0fb01b02a0.1640261993.git.christophe.jaillet@wanadoo.fr>
On 12/23/21 15:20, Christophe JAILLET wrote:
> 'new_free' has just been allocated by kmalloc() and is known to be not
> NULL.
> So this pointer can't be equal to a previous memory allocation, or there
> would be trouble in paradise.
>
> Axe the always true test and make the code more readable.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> fs/ntfs3/bitmap.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c
> index aa184407520f..e3b5680fd516 100644
> --- a/fs/ntfs3/bitmap.c
> +++ b/fs/ntfs3/bitmap.c
> @@ -1333,9 +1333,7 @@ int wnd_extend(struct wnd_bitmap *wnd, size_t new_bits)
> if (!new_free)
> return -ENOMEM;
>
> - if (new_free != wnd->free_bits)
> - memcpy(new_free, wnd->free_bits,
> - wnd->nwnd * sizeof(short));
> + memcpy(new_free, wnd->free_bits, wnd->nwnd * sizeof(short));
> memset(new_free + wnd->nwnd, 0,
> (new_wnd - wnd->nwnd) * sizeof(short));
> kfree(wnd->free_bits);
Thanks for patch, applied!
prev parent reply other threads:[~2022-06-07 15:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-23 12:20 Christophe JAILLET
2022-06-07 15:58 ` 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=4f66239a-2209-6375-95ad-e8be0d28cf85@paragon-software.com \
--to=almaz.alexandrovich@paragon-software.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=kernel-janitors@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
Powered by JetHome