History log of /openbmc/linux/fs/ntfs3/bitmap.c (Results 1 – 25 of 25)
Revision Date Author Comments
# 706cc802 27-Mar-2024 Alexander Lobakin <aleksander.lobakin@intel.com>

fs/ntfs3: add prefix to bitmap_size() and use BITS_TO_U64()

commit 3f5ef5109f6a054ce58b3bec7214ed76c9cc269f upstream.

bitmap_size() is a pretty generic name and one may want to use it for
a generic

fs/ntfs3: add prefix to bitmap_size() and use BITS_TO_U64()

commit 3f5ef5109f6a054ce58b3bec7214ed76c9cc269f upstream.

bitmap_size() is a pretty generic name and one may want to use it for
a generic bitmap API function. At the same time, its logic is
NTFS-specific, as it aligns to the sizeof(u64), not the sizeof(long)
(although it uses ideologically right ALIGN() instead of division).
Add the prefix 'ntfs3_' used for that FS (not just 'ntfs_' to not mix
it with the legacy module) and use generic BITS_TO_U64() while at it.

Suggested-by: Yury Norov <yury.norov@gmail.com> # BITS_TO_U64()
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Yury Norov <yury.norov@gmail.com>
Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

show more ...


# f8599ff1 17-Jun-2024 Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

fs/ntfs3: Missed error return

[ Upstream commit 2cbbd96820255fff4f0ad1533197370c9ccc570b ]

Fixes: 3f3b442b5ad2 ("fs/ntfs3: Add bitmap")
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@parago

fs/ntfs3: Missed error return

[ Upstream commit 2cbbd96820255fff4f0ad1533197370c9ccc570b ]

Fixes: 3f3b442b5ad2 ("fs/ntfs3: Add bitmap")
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>

show more ...


# 86cd4631 16-Jan-2024 Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

fs/ntfs3: Use kvfree to free memory allocated by kvmalloc

[ Upstream commit ddb17dc880eeaac37b5a6e984de07b882de7d78d ]

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
S

fs/ntfs3: Use kvfree to free memory allocated by kvmalloc

[ Upstream commit ddb17dc880eeaac37b5a6e984de07b882de7d78d ]

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>

show more ...


# 4ad5c924 22-Sep-2023 Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

fs/ntfs3: Allow repeated call to ntfs3_put_sbi

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>


# fc471e39 30-Jun-2023 Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

fs/ntfs3: Use kvmalloc instead of kmalloc(... __GFP_NOWARN)

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>


# f0377761 08-May-2023 Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

fs/ntfs3: Code formatting

clang-format-15 was used to format code according kernel's .clang-format.

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>


# 96de65a9 17-Jan-2023 Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

fs/ntfs3: Code formatting and refactoring

Added minor refactoring.
Added and fixed some comments.
In some places, the code has been reformatted to fit into 80 columns.
clang-format-12 was used to fo

fs/ntfs3: Code formatting and refactoring

Added minor refactoring.
Added and fixed some comments.
In some places, the code has been reformatted to fit into 80 columns.
clang-format-12 was used to format code according kernel's .clang-format.

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

show more ...


# 6827d50b 30-Dec-2022 Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

fs/ntfs3: Refactoring of various minor issues

Removed unused macro.
Changed null pointer checking.
Fixed inconsistent indenting.

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-softw

fs/ntfs3: Refactoring of various minor issues

Removed unused macro.
Changed null pointer checking.
Fixed inconsistent indenting.

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

show more ...


# ec5fc720 11-Oct-2022 Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

fs/ntfs3: Improve checking of bad clusters

Added new function wnd_set_used_safe.
Load $BadClus before $AttrDef instead of before $Bitmap.

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@para

fs/ntfs3: Improve checking of bad clusters

Added new function wnd_set_used_safe.
Load $BadClus before $AttrDef instead of before $Bitmap.

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

show more ...


# 08811ba5 06-Oct-2022 Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

fs/ntfs3: Add ntfs_bitmap_weight_le function and refactoring

Added ntfs_bitmap_weight_le function.
Changed argument types of bits/bitmap functions.

Signed-off-by: Konstantin Komarov <almaz.alexandr

fs/ntfs3: Add ntfs_bitmap_weight_le function and refactoring

Added ntfs_bitmap_weight_le function.
Changed argument types of bits/bitmap functions.

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

show more ...


# 095d8ce6 07-Dec-2021 Thomas Kühnel <thomas.kuehnel@avm.de>

fs/ntfs3: Use _le variants of bitops functions

The functions from bitops.h already have _le variants so use them to
prevent invalid reads/writes of the bitmap on big endian systems.

Signed-off-by:

fs/ntfs3: Use _le variants of bitops functions

The functions from bitops.h already have _le variants so use them to
prevent invalid reads/writes of the bitmap on big endian systems.

Signed-off-by: Thomas Kühnel <thomas.kuehnel@avm.de>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

show more ...


# 88a8d0d2 07-Dec-2021 Thomas Kühnel <thomas.kuehnel@avm.de>

fs/ntfs3: Add functions to modify LE bitmaps

__bitmap_set/__bitmap_clear only works with bitmaps in CPU order.
Define a variant of these functions in ntfs3 to handle modifying bitmaps
read from the

fs/ntfs3: Add functions to modify LE bitmaps

__bitmap_set/__bitmap_clear only works with bitmaps in CPU order.
Define a variant of these functions in ntfs3 to handle modifying bitmaps
read from the filesystem.

Signed-off-by: Thomas Kühnel <thomas.kuehnel@avm.de>
Reviewed-by: Nicolas Schier <n.schier@avm.de>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

show more ...


# 0d0f659b 02-Oct-2022 Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>

fs/ntfs3: Use __GFP_NOWARN allocation at wnd_init()

syzbot is reporting too large allocation at wnd_init() [1], for a crafted
filesystem can become wnd->nwnd close to UINT_MAX. Add __GFP_NOWARN in
o

fs/ntfs3: Use __GFP_NOWARN allocation at wnd_init()

syzbot is reporting too large allocation at wnd_init() [1], for a crafted
filesystem can become wnd->nwnd close to UINT_MAX. Add __GFP_NOWARN in
order to avoid too large allocation warning, than exhausting memory by
using kvcalloc().

Link: https://syzkaller.appspot.com/bug?extid=fa4648a5446460b7b963 [1]
Reported-by: syzot <syzbot+fa4648a5446460b7b963@syzkaller.appspotmail.com>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

show more ...


# 557d1967 01-Oct-2022 Abdun Nihaal <abdun.nihaal@gmail.com>

fs/ntfs3: Fix slab-out-of-bounds read in ntfs_trim_fs

Syzbot reports an out of bound access in ntfs_trim_fs.
The cause of this is using a loop termination condition that compares
window index (iw) w

fs/ntfs3: Fix slab-out-of-bounds read in ntfs_trim_fs

Syzbot reports an out of bound access in ntfs_trim_fs.
The cause of this is using a loop termination condition that compares
window index (iw) with wnd->nbits instead of wnd->nwnd, due to which the
index used for wnd->free_bits exceeds the size of the array allocated.

Fix the loop condition.

Fixes: 3f3b442b5ad2 ("fs/ntfs3: Add bitmap")
Link: https://syzkaller.appspot.com/bug?extid=b892240eac461e488d51
Reported-by: syzbot+b892240eac461e488d51@syzkaller.appspotmail.com
Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

show more ...


# 92f017c4 19-Aug-2022 Kenneth Lee <klee33@uw.edu>

fs/ntfs3: Use kmalloc_array for allocating multiple elements

Prefer using kmalloc_array(a, b) over kmalloc(a * b) as this
improves semantics since kmalloc is intended for allocating an
array of memo

fs/ntfs3: Use kmalloc_array for allocating multiple elements

Prefer using kmalloc_array(a, b) over kmalloc(a * b) as this
improves semantics since kmalloc is intended for allocating an
array of memory.

Signed-off-by: Kenneth Lee <klee33@uw.edu>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

show more ...


# 96964352 20-Jul-2022 Jiapeng Chong <jiapeng.chong@linux.alibaba.com>

fs/ntfs3: Remove unused function wnd_bits

Since the function wnd_bits is defined but not called in any file, it is
a useless function, and we delete it in view of the brevity of the code.

Remove so

fs/ntfs3: Remove unused function wnd_bits

Since the function wnd_bits is defined but not called in any file, it is
a useless function, and we delete it in view of the brevity of the code.

Remove some warnings found by running scripts/kernel-doc, which is
caused by using 'make W=1'.

fs/ntfs3/bitmap.c:54:19: warning: unused function 'wnd_bits' [-Wunused-function].

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

show more ...


# 54033c13 06-Jul-2022 Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

fs/ntfs3: Added comments to frecord functions

Added some comments in frecord.c for more context.
Also changed run_lookup to static because it's an internal function.

Signed-off-by: Konstantin Komar

fs/ntfs3: Added comments to frecord functions

Added some comments in frecord.c for more context.
Also changed run_lookup to static because it's an internal function.

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

show more ...


# 548744f8 23-Dec-2021 Christophe JAILLET <christophe.jaillet@wanadoo.fr>

fs/ntfs3: Remove a useless test

'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.

Signed-off-by: Christoph

fs/ntfs3: Remove a useless test

'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.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

show more ...


# 6e3331ee 07-Sep-2021 Kari Argillander <kari.argillander@gmail.com>

fs/ntfs3: Use min/max macros instated of ternary operators

We can make code little bit more readable by using min/max macros.

These were found with Coccinelle.

Signed-off-by: Kari Argillander <kar

fs/ntfs3: Use min/max macros instated of ternary operators

We can make code little bit more readable by using min/max macros.

These were found with Coccinelle.

Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

show more ...


# 9c2aadd0 02-Sep-2021 Kari Argillander <kari.argillander@gmail.com>

fs/ntfs3: Remove unneeded header files from c files

We have lot of unnecessary headers in these files. Remove them so that
we help compiler a little bit.

Signed-off-by: Kari Argillander <kari.argil

fs/ntfs3: Remove unneeded header files from c files

We have lot of unnecessary headers in these files. Remove them so that
we help compiler a little bit.

Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

show more ...


# d3624466 31-Aug-2021 Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

fs/ntfs3: Restyle comments to better align with kernel-doc

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>


# e8b8e97f 03-Aug-2021 Kari Argillander <kari.argillander@gmail.com>

fs/ntfs3: Restyle comments to better align with kernel-doc

Capitalize comments and end with period for better reading.

Also function comments are now little more kernel-doc style. This way we
can e

fs/ntfs3: Restyle comments to better align with kernel-doc

Capitalize comments and end with period for better reading.

Also function comments are now little more kernel-doc style. This way we
can easily convert them to kernel-doc style if we want. Note that these
are not yet complete with this style. Example function comments start
with /* and in kernel-doc style they start /**.

Use imperative mood in function descriptions.

Change words like ntfs -> NTFS, linux -> Linux.

Use "we" not "I" when commenting code.

Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

show more ...


# 345482bc 24-Aug-2021 Kari Argillander <kari.argillander@gmail.com>

fs/ntfs3: Use kcalloc/kmalloc_array over kzalloc/kmalloc

Use kcalloc/kmalloc_array over kzalloc/kmalloc when we allocate array.
Checkpatch found these after we did not use our own defined allocation

fs/ntfs3: Use kcalloc/kmalloc_array over kzalloc/kmalloc

Use kcalloc/kmalloc_array over kzalloc/kmalloc when we allocate array.
Checkpatch found these after we did not use our own defined allocation
wrappers.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

show more ...


# 195c52bd 24-Aug-2021 Kari Argillander <kari.argillander@gmail.com>

fs/ntfs3: Do not use driver own alloc wrappers

Problem with these wrapper is that we cannot take off example GFP_NOFS
flag. It is not recomended use those in all places. Also if we change
one driver

fs/ntfs3: Do not use driver own alloc wrappers

Problem with these wrapper is that we cannot take off example GFP_NOFS
flag. It is not recomended use those in all places. Also if we change
one driver specific wrapper to kernel wrapper then it would look really
weird. People should be most familiar with kernel wrappers so let's just
use those ones.

Driver specific alloc wrapper also confuse some static analyzing tools,
good example is example kernels checkpatch tool. After we converter
these to kernel specific then warnings is showed.

Following Coccinelle script was used to automate changing.

virtual patch

@alloc depends on patch@
expression x;
expression y;
@@
(
- ntfs_malloc(x)
+ kmalloc(x, GFP_NOFS)
|
- ntfs_zalloc(x)
+ kzalloc(x, GFP_NOFS)
|
- ntfs_vmalloc(x)
+ kvmalloc(x, GFP_NOFS)
|
- ntfs_free(x)
+ kfree(x)
|
- ntfs_vfree(x)
+ kvfree(x)
|
- ntfs_memdup(x, y)
+ kmemdup(x, y, GFP_NOFS)
)

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

show more ...


# 3f3b442b 13-Aug-2021 Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

fs/ntfs3: Add bitmap

This adds bitmap

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>