All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 3575/4750] fs/ntfs/namei.c:813:22: warning: cast from pointer to integer of different size
@ 2026-03-09 22:27 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-03-09 22:27 UTC (permalink / raw)
  To: Namjae Jeon; +Cc: oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   ea4134533224d500b2985d30cde106aa3680905d
commit: d9038d99fb5c623f43bcd8b726bfbbe8562648c2 [3575/4750] ntfs: change mft_no type to u64
config: parisc-randconfig-001-20260310 (https://download.01.org/0day-ci/archive/20260310/202603100641.8gfpBfkC-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 14.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260310/202603100641.8gfpBfkC-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603100641.8gfpBfkC-lkp@intel.com/

All warnings (new ones prefixed by >>):

   fs/ntfs/namei.c: In function 'ntfs_test_inode_attr':
>> fs/ntfs/namei.c:813:22: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     813 |         u64 mft_no = (u64)data;
         |                      ^
   fs/ntfs/namei.c: In function 'ntfs_delete':
>> fs/ntfs/namei.c:993:44: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     993 |                                            (void *)ni->mft_no)) != NULL) {
         |                                            ^


vim +813 fs/ntfs/namei.c

   809	
   810	static int ntfs_test_inode_attr(struct inode *vi, void *data)
   811	{
   812		struct ntfs_inode *ni = NTFS_I(vi);
 > 813		u64 mft_no = (u64)data;
   814	
   815		if (ni->mft_no != mft_no)
   816			return 0;
   817		if (NInoAttr(ni) || ni->nr_extents == -1)
   818			return 1;
   819		else
   820			return 0;
   821	}
   822	
   823	/*
   824	 * ntfs_delete - delete file or directory from ntfs volume
   825	 * @ni:         ntfs inode for object to delte
   826	 * @dir_ni:     ntfs inode for directory in which delete object
   827	 * @name:       unicode name of the object to delete
   828	 * @name_len:   length of the name in unicode characters
   829	 * @need_lock:  whether mrec lock is needed or not
   830	 *
   831	 * Delete the specified name from the directory index @dir_ni and decrement
   832	 * the link count of the target inode @ni.
   833	 *
   834	 * Return 0 on success and -errno on error.
   835	 */
   836	static int ntfs_delete(struct ntfs_inode *ni, struct ntfs_inode *dir_ni,
   837			__le16 *name, u8 name_len, bool need_lock)
   838	{
   839		struct ntfs_attr_search_ctx *actx = NULL;
   840		struct file_name_attr *fn = NULL;
   841		bool looking_for_dos_name = false, looking_for_win32_name = false;
   842		bool case_sensitive_match = true;
   843		int err = 0;
   844		struct mft_record *ni_mrec;
   845		struct super_block *sb;
   846		bool link_count_zero = false;
   847	
   848		ntfs_debug("Entering.\n");
   849	
   850		if (need_lock == true) {
   851			mutex_lock_nested(&ni->mrec_lock, NTFS_INODE_MUTEX_NORMAL);
   852			mutex_lock_nested(&dir_ni->mrec_lock, NTFS_INODE_MUTEX_PARENT);
   853		}
   854	
   855		sb = dir_ni->vol->sb;
   856	
   857		if (ni->nr_extents == -1)
   858			ni = ni->ext.base_ntfs_ino;
   859		if (dir_ni->nr_extents == -1)
   860			dir_ni = dir_ni->ext.base_ntfs_ino;
   861		/*
   862		 * Search for FILE_NAME attribute with such name. If it's in POSIX or
   863		 * WIN32_AND_DOS namespace, then simply remove it from index and inode.
   864		 * If filename in DOS or in WIN32 namespace, then remove DOS name first,
   865		 * only then remove WIN32 name.
   866		 */
   867		actx = ntfs_attr_get_search_ctx(ni, NULL);
   868		if (!actx) {
   869			ntfs_error(sb, "%s, Failed to get search context", __func__);
   870			if (need_lock) {
   871				mutex_unlock(&dir_ni->mrec_lock);
   872				mutex_unlock(&ni->mrec_lock);
   873			}
   874			return -ENOMEM;
   875		}
   876	search:
   877		while ((err = ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, CASE_SENSITIVE,
   878					0, NULL, 0, actx)) == 0) {
   879	#ifdef DEBUG
   880			unsigned char *s;
   881	#endif
   882			bool case_sensitive = IGNORE_CASE;
   883	
   884			fn = (struct file_name_attr *)((u8 *)actx->attr +
   885					le16_to_cpu(actx->attr->data.resident.value_offset));
   886	#ifdef DEBUG
   887			s = ntfs_attr_name_get(ni->vol, fn->file_name, fn->file_name_length);
   888			ntfs_debug("name: '%s'  type: %d  dos: %d  win32: %d case: %d\n",
   889					s, fn->file_name_type,
   890					looking_for_dos_name, looking_for_win32_name,
   891					case_sensitive_match);
   892			ntfs_attr_name_free(&s);
   893	#endif
   894			if (looking_for_dos_name) {
   895				if (fn->file_name_type == FILE_NAME_DOS)
   896					break;
   897				continue;
   898			}
   899			if (looking_for_win32_name) {
   900				if  (fn->file_name_type == FILE_NAME_WIN32)
   901					break;
   902				continue;
   903			}
   904	
   905			/* Ignore hard links from other directories */
   906			if (dir_ni->mft_no != MREF_LE(fn->parent_directory)) {
   907				ntfs_debug("MFT record numbers don't match (%llu != %lu)\n",
   908						dir_ni->mft_no,
   909						MREF_LE(fn->parent_directory));
   910				continue;
   911			}
   912	
   913			if (fn->file_name_type == FILE_NAME_POSIX || case_sensitive_match)
   914				case_sensitive = CASE_SENSITIVE;
   915	
   916			if (ntfs_names_are_equal(fn->file_name, fn->file_name_length,
   917						name, name_len, case_sensitive,
   918						ni->vol->upcase, ni->vol->upcase_len)) {
   919				if (fn->file_name_type == FILE_NAME_WIN32) {
   920					looking_for_dos_name = true;
   921					ntfs_attr_reinit_search_ctx(actx);
   922					continue;
   923				}
   924				if (fn->file_name_type == FILE_NAME_DOS)
   925					looking_for_dos_name = true;
   926				break;
   927			}
   928		}
   929		if (err) {
   930			/*
   931			 * If case sensitive search failed, then try once again
   932			 * ignoring case.
   933			 */
   934			if (err == -ENOENT && case_sensitive_match) {
   935				case_sensitive_match = false;
   936				ntfs_attr_reinit_search_ctx(actx);
   937				goto search;
   938			}
   939			goto err_out;
   940		}
   941	
   942		err = ntfs_check_unlinkable_dir(actx, fn);
   943		if (err)
   944			goto err_out;
   945	
   946		err = ntfs_index_remove(dir_ni, fn, le32_to_cpu(actx->attr->data.resident.value_length));
   947		if (err)
   948			goto err_out;
   949	
   950		err = ntfs_attr_record_rm(actx);
   951		if (err)
   952			goto err_out;
   953	
   954		ni_mrec = actx->base_mrec ? actx->base_mrec : actx->mrec;
   955		ni_mrec->link_count = cpu_to_le16(le16_to_cpu(ni_mrec->link_count) - 1);
   956		drop_nlink(VFS_I(ni));
   957	
   958		mark_mft_record_dirty(ni);
   959		if (looking_for_dos_name) {
   960			looking_for_dos_name = false;
   961			looking_for_win32_name = true;
   962			ntfs_attr_reinit_search_ctx(actx);
   963			goto search;
   964		}
   965	
   966		/*
   967		 * If hard link count is not equal to zero then we are done. In other
   968		 * case there are no reference to this inode left, so we should free all
   969		 * non-resident attributes and mark all MFT record as not in use.
   970		 */
   971		if (ni_mrec->link_count == 0) {
   972			NInoSetBeingDeleted(ni);
   973			ntfs_delete_reparse_index(ni);
   974			ntfs_delete_object_id_index(ni);
   975			link_count_zero = true;
   976		}
   977	
   978		ntfs_attr_put_search_ctx(actx);
   979		if (need_lock == true) {
   980			mutex_unlock(&dir_ni->mrec_lock);
   981			mutex_unlock(&ni->mrec_lock);
   982		}
   983	
   984		/*
   985		 * If hard link count is not equal to zero then we are done. In other
   986		 * case there are no reference to this inode left, so we should free all
   987		 * non-resident attributes and mark all MFT record as not in use.
   988		 */
   989		if (link_count_zero == true) {
   990			struct inode *attr_vi;
   991	
   992			while ((attr_vi = ilookup5(sb, ni->mft_no, ntfs_test_inode_attr,
 > 993						   (void *)ni->mft_no)) != NULL) {
   994				clear_nlink(attr_vi);
   995				iput(attr_vi);
   996			}
   997		}
   998		ntfs_debug("Done.\n");
   999		return 0;
  1000	err_out:
  1001		ntfs_attr_put_search_ctx(actx);
  1002		if (need_lock) {
  1003			mutex_unlock(&dir_ni->mrec_lock);
  1004			mutex_unlock(&ni->mrec_lock);
  1005		}
  1006		return err;
  1007	}
  1008	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-03-09 22:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-09 22:27 [linux-next:master 3575/4750] fs/ntfs/namei.c:813:22: warning: cast from pointer to integer of different size kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.