mailweb.openeuler.org
Manage this list

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

Kernel

Threads by month
  • ----- 2025 -----
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
kernel@openeuler.org

  • 43 participants
  • 18180 discussions
[PATCH OLK-5.10 023/107] fs/ntfs3: fix an error code in ntfs_get_acl_ex()
by Yin Xiujiang 08 Dec '21

08 Dec '21
From: Dan Carpenter <dan.carpenter(a)oracle.com> mainline inclusion from mainline-v5.15 commit 2926e4297053c735ab65450192dfba32a4f47fa9 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4G67J?from=project-issue CVE: NA ---------------------------------------------------------------------- The ntfs_get_ea() function returns negative error codes or on success it returns the length. In the original code a zero length return was treated as -ENODATA and results in a NULL return. But it should be treated as an invalid length and result in an PTR_ERR(-EINVAL) return. Fixes: be71b5cba2e6 ("fs/ntfs3: Add attrib operations") Signed-off-by: Dan Carpenter <dan.carpenter(a)oracle.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich(a)paragon-software.com> Signed-off-by: Yin Xiujiang <yinxiujiang(a)kylinos.cn> --- fs/ntfs3/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c index af89e50f7b9f..d3d5b9d331d1 100644 --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -521,7 +521,7 @@ static struct posix_acl *ntfs_get_acl_ex(struct user_namespace *mnt_userns, ni_unlock(ni); /* Translate extended attribute to acl */ - if (err > 0) { + if (err >= 0) { acl = posix_acl_from_xattr(mnt_userns, buf, err); if (!IS_ERR(acl)) set_cached_acl(inode, type, acl); -- 2.30.0
1 0
0 0
[PATCH OLK-5.10 022/107] fs/ntfs3: add checks for allocation failure
by Yin Xiujiang 08 Dec '21

08 Dec '21
From: Dan Carpenter <dan.carpenter(a)oracle.com> mainline inclusion from mainline-v5.15 commit a1b04d380ab64790a7b4a8eb52e14679e47065ab category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4G67J?from=project-issue CVE: NA ---------------------------------------------------------------------- Add a check for when the kzalloc() in init_rsttbl() fails. Some of the callers checked for NULL and some did not. I went down the call tree and added NULL checks where ever they were missing. Fixes: b46acd6a6a62 ("fs/ntfs3: Add NTFS journal") Signed-off-by: Dan Carpenter <dan.carpenter(a)oracle.com> Reviewed-by: Kari Argillander <kari.argillander(a)gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich(a)paragon-software.com> Signed-off-by: Yin Xiujiang <yinxiujiang(a)kylinos.cn> --- fs/ntfs3/fslog.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c index 2c213b55979e..7144ea8a9ab8 100644 --- a/fs/ntfs3/fslog.c +++ b/fs/ntfs3/fslog.c @@ -809,6 +809,9 @@ static inline struct RESTART_TABLE *init_rsttbl(u16 esize, u16 used) u32 lf = sizeof(struct RESTART_TABLE) + (used - 1) * esize; struct RESTART_TABLE *t = kzalloc(bytes, GFP_NOFS); + if (!t) + return NULL; + t->size = cpu_to_le16(esize); t->used = cpu_to_le16(used); t->free_goal = cpu_to_le32(~0u); @@ -831,7 +834,11 @@ static inline struct RESTART_TABLE *extend_rsttbl(struct RESTART_TABLE *tbl, u16 esize = le16_to_cpu(tbl->size); __le32 osize = cpu_to_le32(bytes_per_rt(tbl)); u32 used = le16_to_cpu(tbl->used); - struct RESTART_TABLE *rt = init_rsttbl(esize, used + add); + struct RESTART_TABLE *rt; + + rt = init_rsttbl(esize, used + add); + if (!rt) + return NULL; memcpy(rt + 1, tbl + 1, esize * used); @@ -864,8 +871,11 @@ static inline void *alloc_rsttbl_idx(struct RESTART_TABLE **tbl) __le32 *e; struct RESTART_TABLE *t = *tbl; - if (!t->first_free) + if (!t->first_free) { *tbl = t = extend_rsttbl(t, 16, ~0u); + if (!t) + return NULL; + } off = le32_to_cpu(t->first_free); @@ -4482,6 +4492,10 @@ int log_replay(struct ntfs_inode *ni, bool *initialized) } dp = alloc_rsttbl_idx(&dptbl); + if (!dp) { + err = -ENOMEM; + goto out; + } dp->target_attr = cpu_to_le32(t16); dp->transfer_len = cpu_to_le32(t32 << sbi->cluster_bits); dp->lcns_follow = cpu_to_le32(t32); -- 2.30.0
1 0
0 0
[PATCH OLK-5.10 021/107] fs/ntfs3: Use kcalloc/kmalloc_array over kzalloc/kmalloc
by Yin Xiujiang 08 Dec '21

08 Dec '21
From: Kari Argillander <kari.argillander(a)gmail.com> mainline inclusion from mainline-v5.15 commit 345482bc431f6492beb464696341626057f67771 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4G67J?from=project-issue CVE: NA ---------------------------------------------------------------------- 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(a)lst.de> Signed-off-by: Kari Argillander <kari.argillander(a)gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich(a)paragon-software.com> Signed-off-by: Yin Xiujiang <yinxiujiang(a)kylinos.cn> --- fs/ntfs3/bitmap.c | 2 +- fs/ntfs3/file.c | 2 +- fs/ntfs3/frecord.c | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c index d502bba323d0..2de05062c78b 100644 --- a/fs/ntfs3/bitmap.c +++ b/fs/ntfs3/bitmap.c @@ -683,7 +683,7 @@ int wnd_init(struct wnd_bitmap *wnd, struct super_block *sb, size_t nbits) if (!wnd->bits_last) wnd->bits_last = wbits; - wnd->free_bits = kzalloc(wnd->nwnd * sizeof(u16), GFP_NOFS); + wnd->free_bits = kcalloc(wnd->nwnd, sizeof(u16), GFP_NOFS); if (!wnd->free_bits) return -ENOMEM; diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index 8d27c520bec5..a959f6197c99 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -900,7 +900,7 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from) return -EOPNOTSUPP; } - pages = kmalloc(pages_per_frame * sizeof(struct page *), GFP_NOFS); + pages = kmalloc_array(pages_per_frame, sizeof(struct page *), GFP_NOFS); if (!pages) return -ENOMEM; diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c index 2f7d16543530..329bc76dfb09 100644 --- a/fs/ntfs3/frecord.c +++ b/fs/ntfs3/frecord.c @@ -2054,7 +2054,7 @@ int ni_readpage_cmpr(struct ntfs_inode *ni, struct page *page) idx = (vbo - frame_vbo) >> PAGE_SHIFT; pages_per_frame = frame_size >> PAGE_SHIFT; - pages = kzalloc(pages_per_frame * sizeof(struct page *), GFP_NOFS); + pages = kcalloc(pages_per_frame, sizeof(struct page *), GFP_NOFS); if (!pages) { err = -ENOMEM; goto out; @@ -2137,7 +2137,7 @@ int ni_decompress_file(struct ntfs_inode *ni) frame_bits = ni_ext_compress_bits(ni); frame_size = 1u << frame_bits; pages_per_frame = frame_size >> PAGE_SHIFT; - pages = kzalloc(pages_per_frame * sizeof(struct page *), GFP_NOFS); + pages = kcalloc(pages_per_frame, sizeof(struct page *), GFP_NOFS); if (!pages) { err = -ENOMEM; goto out; @@ -2709,8 +2709,7 @@ int ni_write_frame(struct ntfs_inode *ni, struct page **pages, goto out; } - pages_disk = kzalloc(pages_per_frame * sizeof(struct page *), - GFP_NOFS); + pages_disk = kcalloc(pages_per_frame, sizeof(struct page *), GFP_NOFS); if (!pages_disk) { err = -ENOMEM; goto out; -- 2.30.0
1 0
0 0
[PATCH OLK-5.10 017/107] fs/ntfs3: Remove unused including <linux/version.h>
by Yin Xiujiang 08 Dec '21

08 Dec '21
From: Jiapeng Chong <jiapeng.chong(a)linux.alibaba.com> mainline inclusion from mainline-v5.15 commit 1263eddfea9988125a4b9608efecc8aff2c721f9 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4G67J?from=project-issue CVE: NA ---------------------------------------------------------------------- Eliminate the follow versioncheck warning: ./fs/ntfs3/inode.c: 16 linux/version.h not needed. Reported-by: Abaci Robot <abaci(a)linux.alibaba.com> Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block") Signed-off-by: Jiapeng Chong <jiapeng.chong(a)linux.alibaba.com> Reviewed-by: Kari Argillander <kari.argillander(a)gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich(a)paragon-software.com> Signed-off-by: Yin Xiujiang <yinxiujiang(a)kylinos.cn> --- fs/ntfs3/inode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index a573c6e98cb8..ed64489edf73 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -13,7 +13,6 @@ #include <linux/namei.h> #include <linux/nls.h> #include <linux/uio.h> -#include <linux/version.h> #include <linux/writeback.h> #include "debug.h" -- 2.30.0
1 0
0 0
[PATCH OLK-5.10 016/107] fs/ntfs3: Fix fall-through warnings for Clang
by Yin Xiujiang 08 Dec '21

08 Dec '21
From: "Gustavo A. R. Silva" <gustavoars(a)kernel.org> mainline inclusion from mainline-v5.15 commit abfeb2ee2103f07dd93b9d7b32317e26d1c8ef79 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4G67J?from=project-issue CVE: NA ---------------------------------------------------------------------- Fix the following fallthrough warnings: fs/ntfs3/inode.c:1792:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/ntfs3/index.c:178:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] This helps with the ongoing efforts to globally enable -Wimplicit-fallthrough for Clang. Link: https://github.com/KSPP/linux/issues/115 Signed-off-by: Gustavo A. R. Silva <gustavoars(a)kernel.org> Reviewed-by: Nathan Chancellor <nathan(a)kernel.org> Signed-off-by: Konstantin Komarov <almaz.alexandrovich(a)paragon-software.com> Signed-off-by: Yin Xiujiang <yinxiujiang(a)kylinos.cn> --- fs/ntfs3/index.c | 1 + fs/ntfs3/inode.c | 1 + 2 files changed, 2 insertions(+) diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c index 9386c551e208..189d46e2c38d 100644 --- a/fs/ntfs3/index.c +++ b/fs/ntfs3/index.c @@ -175,6 +175,7 @@ static inline NTFS_CMP_FUNC get_cmp_func(const struct INDEX_ROOT *root) default: break; } + break; default: break; } diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index bf51e294432e..a573c6e98cb8 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -1789,6 +1789,7 @@ int ntfs_unlink_inode(struct inode *dir, const struct dentry *dentry) switch (err) { case 0: drop_nlink(inode); + break; case -ENOTEMPTY: case -ENOSPC: case -EROFS: -- 2.30.0
1 0
0 0
[PATCH OLK-5.10 015/107] fs/ntfs3: Fix one none utf8 char in source file
by Yin Xiujiang 08 Dec '21

08 Dec '21
From: Kari Argillander <kari.argillander(a)gmail.com> mainline inclusion from mainline-v5.15 commit be87e821fdb5ec8c6d404f29e118130c7879ce5b category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4G67J?from=project-issue CVE: NA ---------------------------------------------------------------------- In one source file there is for some reason non utf8 char. But hey this is fs development so this kind of thing might happen. Signed-off-by: Kari Argillander <kari.argillander(a)gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich(a)paragon-software.com> Signed-off-by: Yin Xiujiang <yinxiujiang(a)kylinos.cn> --- fs/ntfs3/frecord.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c index c3121bf9c62f..e377d72477df 100644 --- a/fs/ntfs3/frecord.c +++ b/fs/ntfs3/frecord.c @@ -1784,7 +1784,7 @@ enum REPARSE_SIGN ni_parse_reparse(struct ntfs_inode *ni, struct ATTRIB *attr, /* * WOF - Windows Overlay Filter - used to compress files with lzx/xpress * Unlike native NTFS file compression, the Windows Overlay Filter supports - * only read operations. This means that it doesn�t need to sector-align each + * only read operations. This means that it doesn't need to sector-align each * compressed chunk, so the compressed data can be packed more tightly together. * If you open the file for writing, the Windows Overlay Filter just decompresses * the entire file, turning it back into a plain file. -- 2.30.0
1 0
0 0
[PATCH OLK-5.10 014/107] fs/ntfs3: Remove unused variable cnt in ntfs_security_init()
by Yin Xiujiang 08 Dec '21

08 Dec '21
From: Nathan Chancellor <nathan(a)kernel.org> mainline inclusion from mainline-v5.15 commit 8c01308b6d6b2bc8e9163c6a3400856fb782dee6 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4G67J?from=project-issue CVE: NA ---------------------------------------------------------------------- Clang warns: fs/ntfs3/fsntfs.c:1874:9: warning: variable 'cnt' set but not used [-Wunused-but-set-variable] size_t cnt, off; ^ 1 warning generated. It is indeed unused so remove it. Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block") Signed-off-by: Nathan Chancellor <nathan(a)kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers(a)google.com> Reviewed-by: Kari Argillander <kari.argillander(a)gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich(a)paragon-software.com> Signed-off-by: Yin Xiujiang <yinxiujiang(a)kylinos.cn> --- fs/ntfs3/fsntfs.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c index 92140050fb6c..c6599c514acf 100644 --- a/fs/ntfs3/fsntfs.c +++ b/fs/ntfs3/fsntfs.c @@ -1871,7 +1871,7 @@ int ntfs_security_init(struct ntfs_sb_info *sbi) struct ATTRIB *attr; struct ATTR_LIST_ENTRY *le; u64 sds_size; - size_t cnt, off; + size_t off; struct NTFS_DE *ne; struct NTFS_DE_SII *sii_e; struct ntfs_fnd *fnd_sii = NULL; @@ -1946,7 +1946,6 @@ int ntfs_security_init(struct ntfs_sb_info *sbi) sbi->security.next_off = Quad2Align(sds_size - SecurityDescriptorsBlockSize); - cnt = 0; off = 0; ne = NULL; @@ -1964,8 +1963,6 @@ int ntfs_security_init(struct ntfs_sb_info *sbi) next_id = le32_to_cpu(sii_e->sec_id) + 1; if (next_id >= sbi->security.next_id) sbi->security.next_id = next_id; - - cnt += 1; } sbi->security.ni = ni; -- 2.30.0
1 0
0 0
[PATCH OLK-5.10 013/107] fs/ntfs3: Fix integer overflow in multiplication
by Yin Xiujiang 08 Dec '21

08 Dec '21
From: Colin Ian King <colin.king(a)canonical.com> mainline inclusion from mainline-v5.15 commit 71eeb6ace80be7389d942b9647765417e5b039f7 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4G67J?from=project-issue CVE: NA ---------------------------------------------------------------------- The multiplication of the u32 data_size with a int is being performed using 32 bit arithmetic however the results is being assigned to the variable nbits that is a size_t (64 bit) value. Fix a potential integer overflow by casting the u32 value to a size_t before the multiply to use a size_t sized bit multiply operation. Addresses-Coverity: ("Unintentional integer overflow") Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block") Signed-off-by: Colin Ian King <colin.king(a)canonical.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich(a)paragon-software.com> Signed-off-by: Yin Xiujiang <yinxiujiang(a)kylinos.cn> --- fs/ntfs3/index.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c index 6aa9540ece47..9386c551e208 100644 --- a/fs/ntfs3/index.c +++ b/fs/ntfs3/index.c @@ -2012,7 +2012,7 @@ static int indx_shrink(struct ntfs_index *indx, struct ntfs_inode *ni, unsigned long pos; const unsigned long *bm = resident_data(b); - nbits = le32_to_cpu(b->res.data_size) * 8; + nbits = (size_t)le32_to_cpu(b->res.data_size) * 8; if (bit >= nbits) return 0; -- 2.30.0
1 0
0 0
[PATCH OLK-5.10 012/107] fs/ntfs3: Add ifndef + define to all header files
by Yin Xiujiang 08 Dec '21

08 Dec '21
From: Kari Argillander <kari.argillander(a)gmail.com> mainline inclusion from mainline-v5.15 commit 87790b65343932411af43bc9b218f086ecebd6a5 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4G67J?from=project-issue CVE: NA ---------------------------------------------------------------------- Add guards so that compiler will only include header files once. Signed-off-by: Kari Argillander <kari.argillander(a)gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich(a)paragon-software.com> Signed-off-by: Yin Xiujiang <yinxiujiang(a)kylinos.cn> --- fs/ntfs3/debug.h | 5 +++++ fs/ntfs3/ntfs.h | 3 +++ fs/ntfs3/ntfs_fs.h | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/fs/ntfs3/debug.h b/fs/ntfs3/debug.h index 15ac42185e5b..357d9f4dfba7 100644 --- a/fs/ntfs3/debug.h +++ b/fs/ntfs3/debug.h @@ -7,6 +7,9 @@ */ // clang-format off +#ifndef _LINUX_NTFS3_DEBUG_H +#define _LINUX_NTFS3_DEBUG_H + #ifndef Add2Ptr #define Add2Ptr(P, I) ((void *)((u8 *)(P) + (I))) #define PtrOffset(B, O) ((size_t)((size_t)(O) - (size_t)(B))) @@ -61,4 +64,6 @@ void ntfs_inode_printk(struct inode *inode, const char *fmt, ...) #define ntfs_free(p) kfree(p) #define ntfs_vfree(p) kvfree(p) #define ntfs_memdup(src, len) kmemdup(src, len, GFP_NOFS) + +#endif /* _LINUX_NTFS3_DEBUG_H */ // clang-format on diff --git a/fs/ntfs3/ntfs.h b/fs/ntfs3/ntfs.h index 40398e6c39c9..16da514af124 100644 --- a/fs/ntfs3/ntfs.h +++ b/fs/ntfs3/ntfs.h @@ -7,6 +7,8 @@ */ // clang-format off +#ifndef _LINUX_NTFS3_NTFS_H +#define _LINUX_NTFS3_NTFS_H /* TODO: * - Check 4K mft record and 512 bytes cluster @@ -1235,4 +1237,5 @@ struct SID { }; static_assert(offsetof(struct SID, SubAuthority) == 8); +#endif /* _LINUX_NTFS3_NTFS_H */ // clang-format on diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h index c8ea6dd38c21..b5da2f06f7cb 100644 --- a/fs/ntfs3/ntfs_fs.h +++ b/fs/ntfs3/ntfs_fs.h @@ -6,6 +6,9 @@ */ // clang-format off +#ifndef _LINUX_NTFS3_NTFS_FS_H +#define _LINUX_NTFS3_NTFS_FS_H + #define MINUS_ONE_T ((size_t)(-1)) /* Biggest MFT / smallest cluster */ #define MAXIMUM_BYTES_PER_MFT 4096 @@ -1085,3 +1088,5 @@ static inline void le64_sub_cpu(__le64 *var, u64 val) { *var = cpu_to_le64(le64_to_cpu(*var) - val); } + +#endif /* _LINUX_NTFS3_NTFS_FS_H */ -- 2.30.0
1 0
0 0
[PATCH OLK-5.10 011/107] fs/ntfs3: Use linux/log2 is_power_of_2 function
by Yin Xiujiang 08 Dec '21

08 Dec '21
From: Kari Argillander <kari.argillander(a)gmail.com> mainline inclusion from mainline-v5.15 commit 528c9b3d1edf291685151afecd741d176f527ddf category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4G67J?from=project-issue CVE: NA ---------------------------------------------------------------------- We do not need our own implementation for this function in this driver. It is much better to use generic one. Signed-off-by: Kari Argillander <kari.argillander(a)gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich(a)paragon-software.com> Signed-off-by: Yin Xiujiang <yinxiujiang(a)kylinos.cn> --- fs/ntfs3/ntfs_fs.h | 5 ----- fs/ntfs3/run.c | 3 ++- fs/ntfs3/super.c | 9 +++++---- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h index 0c3ac89c3115..c8ea6dd38c21 100644 --- a/fs/ntfs3/ntfs_fs.h +++ b/fs/ntfs3/ntfs_fs.h @@ -972,11 +972,6 @@ static inline struct buffer_head *ntfs_bread(struct super_block *sb, return NULL; } -static inline bool is_power_of2(size_t v) -{ - return v && !(v & (v - 1)); -} - static inline struct ntfs_inode *ntfs_i(struct inode *inode) { return container_of(inode, struct ntfs_inode, vfs_inode); diff --git a/fs/ntfs3/run.c b/fs/ntfs3/run.c index f9c362ac672e..60c64deab738 100644 --- a/fs/ntfs3/run.c +++ b/fs/ntfs3/run.c @@ -9,6 +9,7 @@ #include <linux/blkdev.h> #include <linux/buffer_head.h> #include <linux/fs.h> +#include <linux/log2.h> #include <linux/nls.h> #include "debug.h" @@ -376,7 +377,7 @@ bool run_add_entry(struct runs_tree *run, CLST vcn, CLST lcn, CLST len, if (!used) { bytes = 64; } else if (used <= 16 * PAGE_SIZE) { - if (is_power_of2(run->allocated)) + if (is_power_of_2(run->allocated)) bytes = run->allocated << 1; else bytes = (size_t)1 diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 84d4f389f685..903975b7e832 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -29,6 +29,7 @@ #include <linux/exportfs.h> #include <linux/fs.h> #include <linux/iversion.h> +#include <linux/log2.h> #include <linux/module.h> #include <linux/nls.h> #include <linux/parser.h> @@ -735,13 +736,13 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size, boot_sector_size = (u32)boot->bytes_per_sector[1] << 8; if (boot->bytes_per_sector[0] || boot_sector_size < SECTOR_SIZE || - !is_power_of2(boot_sector_size)) { + !is_power_of_2(boot_sector_size)) { goto out; } /* cluster size: 512, 1K, 2K, 4K, ... 2M */ sct_per_clst = true_sectors_per_clst(boot); - if (!is_power_of2(sct_per_clst)) + if (!is_power_of_2(sct_per_clst)) goto out; mlcn = le64_to_cpu(boot->mft_clst); @@ -757,14 +758,14 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size, /* Check MFT record size */ if ((boot->record_size < 0 && SECTOR_SIZE > (2U << (-boot->record_size))) || - (boot->record_size >= 0 && !is_power_of2(boot->record_size))) { + (boot->record_size >= 0 && !is_power_of_2(boot->record_size))) { goto out; } /* Check index record size */ if ((boot->index_size < 0 && SECTOR_SIZE > (2U << (-boot->index_size))) || - (boot->index_size >= 0 && !is_power_of2(boot->index_size))) { + (boot->index_size >= 0 && !is_power_of_2(boot->index_size))) { goto out; } -- 2.30.0
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 1647
  • 1648
  • 1649
  • 1650
  • 1651
  • 1652
  • 1653
  • ...
  • 1818
  • Older →

HyperKitty Powered by HyperKitty