Re: [PATCH v11 09/10] fs/ntfs3: Add NTFS3 in fs/Kconfig and fs/Makefile

2020-11-02 Thread kernel test robot
Hi Konstantin,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.10-rc2 next-20201102]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:
https://github.com/0day-ci/linux/commits/Konstantin-Komarov/NTFS-read-write-driver-GPL-implementation-by-Paragon-Software/20201031-220904
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
5fc6b075e165f641fbc366b58b578055762d5f8c
config: alpha-allmodconfig (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# 
https://github.com/0day-ci/linux/commit/0868596d71532d31ce16ee71c5e73c154878416e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review 
Konstantin-Komarov/NTFS-read-write-driver-GPL-implementation-by-Paragon-Software/20201031-220904
git checkout 0868596d71532d31ce16ee71c5e73c154878416e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross 
ARCH=alpha 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

   In file included from fs/ntfs3/frecord.c:15:
   fs/ntfs3/ntfs.h:430:1: warning: 'inline' is not at beginning of declaration 
[-Wold-style-declaration]
 430 | static const inline __le16 *attr_name(const struct ATTRIB *attr)
 | ^~
   fs/ntfs3/ntfs.h:547:1: warning: 'inline' is not at beginning of declaration 
[-Wold-style-declaration]
 547 | static const inline __le16 *le_name(const struct ATTR_LIST_ENTRY *le)
 | ^~
   fs/ntfs3/frecord.c: In function 'ni_read_frame':
>> fs/ntfs3/frecord.c:2247:17: error: implicit declaration of function 'vmap'; 
>> did you mean 'kmap'? [-Werror=implicit-function-declaration]
2247 |  frame_ondisk = vmap(pages_disk, npages_disk, VM_MAP, PAGE_KERNEL);
 | ^~~~
 | kmap
>> fs/ntfs3/frecord.c:2247:47: error: 'VM_MAP' undeclared (first use in this 
>> function); did you mean 'VM_MTE'?
2247 |  frame_ondisk = vmap(pages_disk, npages_disk, VM_MAP, PAGE_KERNEL);
 |   ^~
 |   VM_MTE
   fs/ntfs3/frecord.c:2247:47: note: each undeclared identifier is reported 
only once for each function it appears in
>> fs/ntfs3/frecord.c:2278:2: error: implicit declaration of function 'vunmap'; 
>> did you mean 'kunmap'? [-Werror=implicit-function-declaration]
2278 |  vunmap(frame_mem);
 |  ^~
 |  kunmap
   fs/ntfs3/frecord.c: In function 'ni_write_frame':
   fs/ntfs3/frecord.c:2375:51: error: 'VM_MAP' undeclared (first use in this 
function); did you mean 'VM_MTE'?
2375 |  frame_ondisk = vmap(pages_disk, pages_per_frame, VM_MAP, 
PAGE_KERNEL);
 |   ^~
 |   VM_MTE
   cc1: some warnings being treated as errors

vim +2247 fs/ntfs3/frecord.c

8f609ab22280366 Konstantin Komarov 2020-10-30  2099  
8f609ab22280366 Konstantin Komarov 2020-10-30  2100  /*
8f609ab22280366 Konstantin Komarov 2020-10-30  2101   * ni_read_frame
8f609ab22280366 Konstantin Komarov 2020-10-30  2102   *
8f609ab22280366 Konstantin Komarov 2020-10-30  2103   * pages - array of locked 
pages
8f609ab22280366 Konstantin Komarov 2020-10-30  2104   */
8f609ab22280366 Konstantin Komarov 2020-10-30  2105  int ni_read_frame(struct 
ntfs_inode *ni, u64 frame_vbo, struct page **pages,
8f609ab22280366 Konstantin Komarov 2020-10-30  2106   u32 
pages_per_frame)
8f609ab22280366 Konstantin Komarov 2020-10-30  2107  {
8f609ab22280366 Konstantin Komarov 2020-10-30  2108 int err;
8f609ab22280366 Konstantin Komarov 2020-10-30  2109 struct ntfs_sb_info 
*sbi = ni->mi.sbi;
8f609ab22280366 Konstantin Komarov 2020-10-30  2110 char *frame_ondisk = 
NULL;
8f609ab22280366 Konstantin Komarov 2020-10-30  2111 char *frame_mem = NULL;
8f609ab22280366 Konstantin Komarov 2020-10-30  2112 struct page 
**pages_disk = NULL;
8f609ab22280366 Konstantin Komarov 2020-10-30  2113 u64 valid_size = 
ni->i_valid;
8f609ab22280366 Konstantin Komarov 2020-10-30  2114 u32 frame_size;
8f609ab22280366 Konstantin Komarov 2020-10-30  2115 size_t unc_size;
8f609ab22280366 Konstantin Komarov 2020-10-30  2116 u32 ondisk_size, i, 
npages_disk;
8f609ab22280366 Konstantin Komarov 2020-10-30  2117 struct page *pg;
8f609ab22280366 Konstantin Komarov 2020-10-30  2118 struct ATTRIB *attr;
8f609ab22280366 Konstantin Komarov 202

[kbuild] Re: [PATCH v11 09/10] fs/ntfs3: Add NTFS3 in fs/Kconfig and fs/Makefile

2020-11-02 Thread Dan Carpenter
Hi Konstantin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.10-rc2 next-20201030]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch ]

url:
https://github.com/0day-ci/linux/commits/Konstantin-Komarov/NTFS-read-write-driver-GPL-implementation-by-Paragon-Software/20201031-220904
 
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git  
5fc6b075e165f641fbc366b58b578055762d5f8c
config: i386-randconfig-m021-20201101 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
fs/ntfs3/attrib.c:331 attr_set_size_res() error: dereferencing freed memory 
'attr_s'
fs/ntfs3/attrib.c:1267 attr_allocate_frame() error: uninitialized symbol 'hint'.
fs/ntfs3/attrib.c:1393 attr_allocate_frame() error: we previously assumed 
'attr_b' could be null (see line 1306)
fs/ntfs3/namei.c:438 ntfs_rename() warn: variable dereferenced before check 
'old_inode' (see line 296)
fs/ntfs3/fsntfs.c:844 ntfs_clear_mft_tail() error: uninitialized symbol 'err'.
fs/ntfs3/fsntfs.c:1294 ntfs_read_run_nb() error: uninitialized symbol 'idx'.
fs/ntfs3/frecord.c:166 ni_load_mi_ex() error: we previously assumed 'r' could 
be null (see line 159)
fs/ntfs3/frecord.c:505 ni_ins_new_attr() error: we previously assumed 'le' 
could be null (see line 490)
fs/ntfs3/frecord.c:658 ni_repack() warn: 'run.runs_' double freed
fs/ntfs3/frecord.c:1439 ni_insert_nonresident() warn: potential memory 
corrupting cast 8 vs 2 bytes
fs/ntfs3/frecord.c:2214 ni_read_frame() warn: ignoring unreachable code.
fs/ntfs3/xattr.c:514 ntfs_get_acl_ex() warn: passing zero to 'ERR_PTR'
fs/ntfs3/index.c:1133 indx_find() warn: variable dereferenced before check 
'fnd' (see line 1117)
fs/ntfs3/index.c:1371 indx_find_raw() error: we previously assumed 'n' could be 
null (see line 1349)
fs/ntfs3/index.c:1404 indx_create_allocate() warn: should '1 << 
indx->index_bits' be a 64 bit type?
fs/ntfs3/index.c:1755 indx_insert_into_root() warn: possible memory leak of 're'
fs/ntfs3/index.c:549 hdr_find_split() warn: variable dereferenced before check 
'e' (see line 547)
fs/ntfs3/inode.c:687 ntfs_readpage() warn: should 'page->index << 12' be a 64 
bit type?
fs/ntfs3/fslog.c:2205 last_log_lsn() warn: possible memory leak of 'page_bufs'
fs/ntfs3/fslog.c:2418 find_log_rec() error: we previously assumed 'rh' could be 
null (see line 2404)
fs/ntfs3/fslog.c:2551 find_client_next_lsn() error: double free of 'lcb->lrh'
fs/ntfs3/fslog.c:639 enum_rstbl() error: we previously assumed 't' could be 
null (see line 628)
fs/ntfs3/fslog.c:3158 do_action() warn: variable dereferenced before check 'mi' 
(see line 3118)
fs/ntfs3/fslog.c:3913 log_replay() error: dereferencing freed memory 
'rst_info.r_page'

vim +/attr_s +331 fs/ntfs3/attrib.c

e3a1cdcc648083 Konstantin Komarov 2020-10-30  241  static int 
attr_set_size_res(struct ntfs_inode *ni, struct ATTRIB *attr,
e3a1cdcc648083 Konstantin Komarov 2020-10-30  242
struct ATTR_LIST_ENTRY *le, struct mft_inode *mi,
e3a1cdcc648083 Konstantin Komarov 2020-10-30  243
u64 new_size, struct runs_tree *run,
e3a1cdcc648083 Konstantin Komarov 2020-10-30  244
struct ATTRIB **ins_attr)
e3a1cdcc648083 Konstantin Komarov 2020-10-30  245  {
e3a1cdcc648083 Konstantin Komarov 2020-10-30  246   int err = 0;
e3a1cdcc648083 Konstantin Komarov 2020-10-30  247   struct ntfs_sb_info 
*sbi = mi->sbi;
e3a1cdcc648083 Konstantin Komarov 2020-10-30  248   struct MFT_REC *rec = 
mi->mrec;
e3a1cdcc648083 Konstantin Komarov 2020-10-30  249   u32 used = 
le32_to_cpu(rec->used);
e3a1cdcc648083 Konstantin Komarov 2020-10-30  250   u32 asize = 
le32_to_cpu(attr->size);
e3a1cdcc648083 Konstantin Komarov 2020-10-30  251   u32 aoff = 
PtrOffset(rec, attr);
e3a1cdcc648083 Konstantin Komarov 2020-10-30  252   u32 rsize = 
le32_to_cpu(attr->res.data_size);
e3a1cdcc648083 Konstantin Komarov 2020-10-30  253   u32 tail = used - aoff 
- asize;
e3a1cdcc648083 Konstantin Komarov 2020-10-30  254   char *next = 
Add2Ptr(attr, asize);
e3a1cdcc648083 Konstantin Komarov 2020-10-30  255   int dsize = 
QuadAlign(new_size) - QuadAlign(rsize);
e3a1cdcc648083 Konstantin Komarov 2020-10-30  256   CLST len, alen;
e3a1cdcc648083 Konstantin Komarov 2020-10-30  257   struct ATTRIB *attr_s = 
NULL;
e3a1cdcc648083 Konstantin Komarov 2020-10-30  258   bool is_ext;
e3a1cdcc648083 Konstantin Komarov 2020-10-30  259  
e3a1cdcc648083 Konstantin Komarov 2020-10-30  260   if (dsize < 0) {
e3a1cdcc648083 Konstantin Komarov 2020-10-30  261   memmove(next + 
dsize, next, tail);
e3a1cdcc648083 Konstantin Koma

Re: [PATCH v11 09/10] fs/ntfs3: Add NTFS3 in fs/Kconfig and fs/Makefile

2020-10-30 Thread kernel test robot
Hi Konstantin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.10-rc1 next-20201030]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:
https://github.com/0day-ci/linux/commits/Konstantin-Komarov/NTFS-read-write-driver-GPL-implementation-by-Paragon-Software/20201030-230756
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
07e0887302450a62f51dba72df6afb5fabb23d1c
config: h8300-randconfig-s031-20201030 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-68-g49c98aa3-dirty
# 
https://github.com/0day-ci/linux/commit/7c34316b6c7f9af2046f8343d3b010c37340ef1d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review 
Konstantin-Komarov/NTFS-read-write-driver-GPL-implementation-by-Paragon-Software/20201030-230756
git checkout 7c34316b6c7f9af2046f8343d3b010c37340ef1d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=h8300 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 


"sparse warnings: (new ones prefixed by >>)"
>> fs/ntfs3/frecord.c:569:33: sparse: sparse: cast to restricted __le32
>> fs/ntfs3/frecord.c:569:33: sparse: sparse: cast from restricted __le64
>> fs/ntfs3/frecord.c:569:33: sparse: sparse: cast to restricted __le32
>> fs/ntfs3/frecord.c:569:33: sparse: sparse: cast from restricted __le64
>> fs/ntfs3/frecord.c:569:33: sparse: sparse: cast to restricted __le32
>> fs/ntfs3/frecord.c:569:33: sparse: sparse: cast from restricted __le64
>> fs/ntfs3/frecord.c:569:33: sparse: sparse: cast to restricted __le32
>> fs/ntfs3/frecord.c:569:33: sparse: sparse: cast from restricted __le64
>> fs/ntfs3/frecord.c:569:33: sparse: sparse: cast to restricted __le32
>> fs/ntfs3/frecord.c:569:33: sparse: sparse: cast from restricted __le64
>> fs/ntfs3/frecord.c:569:33: sparse: sparse: cast to restricted __le32
>> fs/ntfs3/frecord.c:569:33: sparse: sparse: cast from restricted __le64

vim +569 fs/ntfs3/frecord.c

cbd4257e6d85149 Konstantin Komarov 2020-10-30  532  
cbd4257e6d85149 Konstantin Komarov 2020-10-30  533  /*
cbd4257e6d85149 Konstantin Komarov 2020-10-30  534   * random write access to 
sparsed or compressed file may result to
cbd4257e6d85149 Konstantin Komarov 2020-10-30  535   * not optimized packed 
runs.
cbd4257e6d85149 Konstantin Komarov 2020-10-30  536   * Here it is the place to 
optimize it
cbd4257e6d85149 Konstantin Komarov 2020-10-30  537   */
cbd4257e6d85149 Konstantin Komarov 2020-10-30  538  static int ni_repack(struct 
ntfs_inode *ni)
cbd4257e6d85149 Konstantin Komarov 2020-10-30  539  {
cbd4257e6d85149 Konstantin Komarov 2020-10-30  540  int err = 0;
cbd4257e6d85149 Konstantin Komarov 2020-10-30  541  struct ntfs_sb_info 
*sbi = ni->mi.sbi;
cbd4257e6d85149 Konstantin Komarov 2020-10-30  542  struct mft_inode *mi, 
*mi_p = NULL;
cbd4257e6d85149 Konstantin Komarov 2020-10-30  543  struct ATTRIB *attr = 
NULL, *attr_p;
cbd4257e6d85149 Konstantin Komarov 2020-10-30  544  struct ATTR_LIST_ENTRY 
*le = NULL, *le_p;
cbd4257e6d85149 Konstantin Komarov 2020-10-30  545  CLST alloc = 0;
cbd4257e6d85149 Konstantin Komarov 2020-10-30  546  u8 cluster_bits = 
sbi->cluster_bits;
cbd4257e6d85149 Konstantin Komarov 2020-10-30  547  CLST svcn, evcn = 0, 
svcn_p, evcn_p, next_svcn;
cbd4257e6d85149 Konstantin Komarov 2020-10-30  548  u32 roff, rs = 
sbi->record_size;
cbd4257e6d85149 Konstantin Komarov 2020-10-30  549  struct runs_tree run;
cbd4257e6d85149 Konstantin Komarov 2020-10-30  550  
cbd4257e6d85149 Konstantin Komarov 2020-10-30  551  run_init(&run);
cbd4257e6d85149 Konstantin Komarov 2020-10-30  552  
cbd4257e6d85149 Konstantin Komarov 2020-10-30  553  while ((attr = 
ni_enum_attr_ex(ni, attr, &le))) {
cbd4257e6d85149 Konstantin Komarov 2020-10-30  554  if 
(!attr->non_res)
cbd4257e6d85149 Konstantin Komarov 2020-10-30  555  
continue;
cbd4257e6d85149 Konstantin Komarov 2020-10-30  556  
cbd4257e6d85149 Konstantin Komarov 2020-10-30  557  if 
(ni_load_mi(ni, le, &mi)) {
cbd4257e6d85149 Konstantin Komarov 2020-10-30  558  err = 
-EINVAL;
cbd4257e6d85149 Konstantin Komarov 2020-10-30  559  break;
cbd4257e6d85149 Konstantin Komarov 2020-10-30  560  }
cbd4257e6d85149 Konstantin Komarov 2020-10-30  561  
cbd4257e6d85149 Konstantin Komarov 2020-10-30  562

[PATCH v11 09/10] fs/ntfs3: Add NTFS3 in fs/Kconfig and fs/Makefile

2020-10-30 Thread Konstantin Komarov
This adds NTFS3 in fs/Kconfig and fs/Makefile

Signed-off-by: Konstantin Komarov 
---
 fs/Kconfig  | 1 +
 fs/Makefile | 1 +
 2 files changed, 2 insertions(+)

diff --git a/fs/Kconfig b/fs/Kconfig
index aa4c12282301..eae96d55ab67 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -145,6 +145,7 @@ menu "DOS/FAT/EXFAT/NT Filesystems"
 source "fs/fat/Kconfig"
 source "fs/exfat/Kconfig"
 source "fs/ntfs/Kconfig"
+source "fs/ntfs3/Kconfig"
 
 endmenu
 endif # BLOCK
diff --git a/fs/Makefile b/fs/Makefile
index 999d1a23f036..4f5242cdaee2 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -100,6 +100,7 @@ obj-$(CONFIG_SYSV_FS)   += sysv/
 obj-$(CONFIG_CIFS) += cifs/
 obj-$(CONFIG_HPFS_FS)  += hpfs/
 obj-$(CONFIG_NTFS_FS)  += ntfs/
+obj-$(CONFIG_NTFS3_FS) += ntfs3/
 obj-$(CONFIG_UFS_FS)   += ufs/
 obj-$(CONFIG_EFS_FS)   += efs/
 obj-$(CONFIG_JFFS2_FS) += jffs2/
-- 
2.25.4