[chao:bugfix/common 5/13] fs/f2fs/file.c:177:13: sparse: sparse: incorrect type in assignment (different base types)

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git bugfix/common
head:   23c6aad9d7d40c811878131e6c9fe073b889a246
commit: 023eade52f637a4ab23304baff65191d0292eb30 [5/13] f2fs: fix to zero post-EOF data when extending file size
config: i386-randconfig-062-20260807 (https://download.01.org/0day-ci/archive/20260808/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260808/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)
>> fs/f2fs/file.c:177:13: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted vm_fault_t [usertype] ret @@     got int @@
   fs/f2fs/file.c:177:13: sparse:     expected restricted vm_fault_t [usertype] ret
   fs/f2fs/file.c:177:13: sparse:     got int
   fs/f2fs/file.c:4077:36: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned short const [usertype] *pwcs @@     got restricted __le16 * @@
   fs/f2fs/file.c:4077:36: sparse:     expected unsigned short const [usertype] *pwcs
   fs/f2fs/file.c:4077:36: sparse:     got restricted __le16 *
   fs/f2fs/file.c:4113:28: sparse: sparse: incorrect type in argument 4 (different base types) @@     expected unsigned short [usertype] *pwcs @@     got restricted __le16 * @@
   fs/f2fs/file.c:4113:28: sparse:     expected unsigned short [usertype] *pwcs
   fs/f2fs/file.c:4113:28: sparse:     got restricted __le16 *

vim +177 fs/f2fs/file.c

   115	
   116	static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf)
   117	{
   118		struct folio *folio = page_folio(vmf->page);
   119		struct inode *inode = file_inode(vmf->vma->vm_file);
   120		struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
   121		struct dnode_of_data dn;
   122		bool need_alloc = !f2fs_is_pinned_file(inode);
   123		int err = 0;
   124		vm_fault_t ret;
   125	
   126		/*
   127		 * We only support large folio on the read case.
   128		 * Don't make any dirty pages.
   129		 */
   130		if (unlikely(IS_IMMUTABLE(inode)) ||
   131		    mapping_large_folio_support(inode->i_mapping)) {
   132			f2fs_err(sbi, "Not expected: immutable: %d large_folio: %d",
   133					IS_IMMUTABLE(inode),
   134					mapping_large_folio_support(inode->i_mapping));
   135			return VM_FAULT_SIGBUS;
   136		}
   137	
   138		if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) {
   139			err = -EIO;
   140			goto out;
   141		}
   142	
   143		if (unlikely(f2fs_cp_error(sbi))) {
   144			err = -EIO;
   145			goto out;
   146		}
   147	
   148		if (!f2fs_is_checkpoint_ready(sbi)) {
   149			err = -ENOSPC;
   150			goto out;
   151		}
   152	
   153		err = f2fs_convert_inline_inode(inode);
   154		if (err)
   155			goto out;
   156	
   157	#ifdef CONFIG_F2FS_FS_COMPRESSION
   158		if (f2fs_compressed_file(inode)) {
   159			int ret = f2fs_is_compressed_cluster(inode, folio->index);
   160	
   161			if (ret < 0) {
   162				err = ret;
   163				goto out;
   164			} else if (ret) {
   165				need_alloc = false;
   166			}
   167		}
   168	#endif
   169		/* should do out of any locked page */
   170		if (need_alloc)
   171			f2fs_balance_fs(sbi, true);
   172	
   173		sb_start_pagefault(inode->i_sb);
   174	
   175		f2fs_bug_on(sbi, f2fs_has_inline_data(inode));
   176	
 > 177		ret = f2fs_zero_post_eof_page(inode,
   178			(folio->index + 1) << PAGE_SHIFT, true);
   179		if (ret)
   180			goto out_pagefault;
   181	
   182		file_update_time(vmf->vma->vm_file);
   183		filemap_invalidate_lock_shared(inode->i_mapping);
   184	
   185		folio_lock(folio);
   186		if (unlikely(folio->mapping != inode->i_mapping ||
   187				folio_pos(folio) > i_size_read(inode) ||
   188				!folio_test_uptodate(folio))) {
   189			folio_unlock(folio);
   190			err = -EFAULT;
   191			goto out_sem;
   192		}
   193	
   194		set_new_dnode(&dn, inode, NULL, NULL, 0);
   195		if (need_alloc) {
   196			/* block allocation */
   197			err = f2fs_get_block_locked(&dn, folio->index);
   198		} else {
   199			err = f2fs_get_dnode_of_data(&dn, folio->index, LOOKUP_NODE);
   200			f2fs_put_dnode(&dn);
   201			if (f2fs_is_pinned_file(inode) &&
   202			    !__is_valid_data_blkaddr(dn.data_blkaddr))
   203				err = -EIO;
   204		}
   205	
   206		if (err) {
   207			folio_unlock(folio);
   208			goto out_sem;
   209		}
   210	
   211		f2fs_folio_wait_writeback(folio, DATA, false, true);
   212	
   213		/* wait for GCed page writeback via META_MAPPING */
   214		f2fs_wait_on_block_writeback(inode, dn.data_blkaddr);
   215	
   216		/*
   217		 * check to see if the page is mapped already (no holes)
   218		 */
   219		if (folio_test_mappedtodisk(folio))
   220			goto out_sem;
   221	
   222		/* page is wholly or partially inside EOF */
   223		if (((loff_t)(folio->index + 1) << PAGE_SHIFT) >
   224							i_size_read(inode)) {
   225			loff_t offset;
   226	
   227			offset = i_size_read(inode) & ~PAGE_MASK;
   228			folio_zero_segment(folio, offset, folio_size(folio));
   229		}
   230		folio_mark_dirty(folio);
   231	
   232		f2fs_update_iostat(sbi, inode, APP_MAPPED_IO, F2FS_BLKSIZE);
   233		f2fs_update_time(sbi, REQ_TIME);
   234	
   235	out_sem:
   236		filemap_invalidate_unlock_shared(inode->i_mapping);
   237	out_pagefault:
   238		sb_end_pagefault(inode->i_sb);
   239	out:
   240		ret = vmf_fs_error(err);
   241	
   242		trace_f2fs_vm_page_mkwrite(inode, folio->index, vmf->vma->vm_flags, ret);
   243		return ret;
   244	}
   245	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.