All of lore.kernel.org
 help / color / mirror / Atom feed
* [hch-xfs:xfs-remove-dirnameops 2/2] fs/xfs/libxfs/xfs_dir2_block.c:1221:36: sparse: sparse: incorrect type in assignment (different base types)
@ 2019-11-11 17:19 kbuild test robot
  0 siblings, 0 replies; only message in thread
From: kbuild test robot @ 2019-11-11 17:19 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 8349 bytes --]

tree:   git://git.infradead.org/users/hch/xfs xfs-remove-dirnameops
head:   3d6ba7e66e08eb7a5ed830763b4e419a81f51d17
commit: 3d6ba7e66e08eb7a5ed830763b4e419a81f51d17 [2/2] xfs: remove ->m_dirnameops
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-29-g781bc5d-dirty
        git checkout 3d6ba7e66e08eb7a5ed830763b4e419a81f51d17
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

>> fs/xfs/libxfs/xfs_dir2_block.c:1221:36: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __be32 [usertype] hashval @@    got  [usertype] hashval @@
>> fs/xfs/libxfs/xfs_dir2_block.c:1221:36: sparse:    expected restricted __be32 [usertype] hashval
>> fs/xfs/libxfs/xfs_dir2_block.c:1221:36: sparse:    got unsigned int

vim +1221 fs/xfs/libxfs/xfs_dir2_block.c

  1036	
  1037	/*
  1038	 * Convert the shortform directory to block form.
  1039	 */
  1040	int						/* error */
  1041	xfs_dir2_sf_to_block(
  1042		struct xfs_da_args	*args)
  1043	{
  1044		struct xfs_trans	*tp = args->trans;
  1045		struct xfs_inode	*dp = args->dp;
  1046		struct xfs_mount	*mp = dp->i_mount;
  1047		struct xfs_ifork	*ifp = XFS_IFORK_PTR(dp, XFS_DATA_FORK);
  1048		struct xfs_da_geometry	*geo = args->geo;
  1049		xfs_dir2_db_t		blkno;		/* dir-relative block # (0) */
  1050		xfs_dir2_data_hdr_t	*hdr;		/* block header */
  1051		xfs_dir2_leaf_entry_t	*blp;		/* block leaf entries */
  1052		struct xfs_buf		*bp;		/* block buffer */
  1053		xfs_dir2_block_tail_t	*btp;		/* block tail pointer */
  1054		xfs_dir2_data_entry_t	*dep;		/* data entry pointer */
  1055		int			dummy;		/* trash */
  1056		xfs_dir2_data_unused_t	*dup;		/* unused entry pointer */
  1057		int			endoffset;	/* end of data objects */
  1058		int			error;		/* error return value */
  1059		int			i;		/* index */
  1060		int			needlog;	/* need to log block header */
  1061		int			needscan;	/* need to scan block freespc */
  1062		int			newoffset;	/* offset from current entry */
  1063		unsigned int		offset = geo->data_entry_offset;
  1064		xfs_dir2_sf_entry_t	*sfep;		/* sf entry pointer */
  1065		xfs_dir2_sf_hdr_t	*oldsfp;	/* old shortform header  */
  1066		xfs_dir2_sf_hdr_t	*sfp;		/* shortform header  */
  1067		__be16			*tagp;		/* end of data entry */
  1068		struct xfs_name		name;
  1069	
  1070		trace_xfs_dir2_sf_to_block(args);
  1071	
  1072		ASSERT(ifp->if_flags & XFS_IFINLINE);
  1073		ASSERT(dp->i_d.di_size >= offsetof(struct xfs_dir2_sf_hdr, parent));
  1074	
  1075		oldsfp = (xfs_dir2_sf_hdr_t *)ifp->if_u1.if_data;
  1076	
  1077		ASSERT(ifp->if_bytes == dp->i_d.di_size);
  1078		ASSERT(ifp->if_u1.if_data != NULL);
  1079		ASSERT(dp->i_d.di_size >= xfs_dir2_sf_hdr_size(oldsfp->i8count));
  1080		ASSERT(dp->i_d.di_nextents == 0);
  1081	
  1082		/*
  1083		 * Copy the directory into a temporary buffer.
  1084		 * Then pitch the incore inode data so we can make extents.
  1085		 */
  1086		sfp = kmem_alloc(ifp->if_bytes, 0);
  1087		memcpy(sfp, oldsfp, ifp->if_bytes);
  1088	
  1089		xfs_idata_realloc(dp, -ifp->if_bytes, XFS_DATA_FORK);
  1090		xfs_bmap_local_to_extents_empty(tp, dp, XFS_DATA_FORK);
  1091		dp->i_d.di_size = 0;
  1092	
  1093		/*
  1094		 * Add block 0 to the inode.
  1095		 */
  1096		error = xfs_dir2_grow_inode(args, XFS_DIR2_DATA_SPACE, &blkno);
  1097		if (error)
  1098			goto out_free;
  1099		/*
  1100		 * Initialize the data block, then convert it to block format.
  1101		 */
  1102		error = xfs_dir3_data_init(args, blkno, &bp);
  1103		if (error)
  1104			goto out_free;
  1105		xfs_dir3_block_init(mp, tp, bp, dp);
  1106		hdr = bp->b_addr;
  1107	
  1108		/*
  1109		 * Compute size of block "tail" area.
  1110		 */
  1111		i = (uint)sizeof(*btp) +
  1112		    (sfp->count + 2) * (uint)sizeof(xfs_dir2_leaf_entry_t);
  1113		/*
  1114		 * The whole thing is initialized to free by the init routine.
  1115		 * Say we're using the leaf and tail area.
  1116		 */
  1117		dup = bp->b_addr + offset;
  1118		needlog = needscan = 0;
  1119		error = xfs_dir2_data_use_free(args, bp, dup, args->geo->blksize - i,
  1120				i, &needlog, &needscan);
  1121		if (error)
  1122			goto out_free;
  1123		ASSERT(needscan == 0);
  1124		/*
  1125		 * Fill in the tail.
  1126		 */
  1127		btp = xfs_dir2_block_tail_p(args->geo, hdr);
  1128		btp->count = cpu_to_be32(sfp->count + 2);	/* ., .. */
  1129		btp->stale = 0;
  1130		blp = xfs_dir2_block_leaf_p(btp);
  1131		endoffset = (uint)((char *)blp - (char *)hdr);
  1132		/*
  1133		 * Remove the freespace, we'll manage it.
  1134		 */
  1135		error = xfs_dir2_data_use_free(args, bp, dup,
  1136				(xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr),
  1137				be16_to_cpu(dup->length), &needlog, &needscan);
  1138		if (error)
  1139			goto out_free;
  1140	
  1141		/*
  1142		 * Create entry for .
  1143		 */
  1144		dep = bp->b_addr + offset;
  1145		dep->inumber = cpu_to_be64(dp->i_ino);
  1146		dep->namelen = 1;
  1147		dep->name[0] = '.';
  1148		xfs_dir2_data_put_ftype(mp, dep, XFS_DIR3_FT_DIR);
  1149		tagp = xfs_dir2_data_entry_tag_p(mp, dep);
  1150		*tagp = cpu_to_be16(offset);
  1151		xfs_dir2_data_log_entry(args, bp, dep);
  1152		blp[0].hashval = cpu_to_be32(xfs_dir_hash_dot);
  1153		blp[0].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(offset));
  1154		offset += xfs_dir2_data_entsize(mp, dep->namelen);
  1155	
  1156		/*
  1157		 * Create entry for ..
  1158		 */
  1159		dep = bp->b_addr + offset;
  1160		dep->inumber = cpu_to_be64(xfs_dir2_sf_get_parent_ino(sfp));
  1161		dep->namelen = 2;
  1162		dep->name[0] = dep->name[1] = '.';
  1163		xfs_dir2_data_put_ftype(mp, dep, XFS_DIR3_FT_DIR);
  1164		tagp = xfs_dir2_data_entry_tag_p(mp, dep);
  1165		*tagp = cpu_to_be16(offset);
  1166		xfs_dir2_data_log_entry(args, bp, dep);
  1167		blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot);
  1168		blp[1].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(offset));
  1169		offset += xfs_dir2_data_entsize(mp, dep->namelen);
  1170	
  1171		/*
  1172		 * Loop over existing entries, stuff them in.
  1173		 */
  1174		i = 0;
  1175		if (!sfp->count)
  1176			sfep = NULL;
  1177		else
  1178			sfep = xfs_dir2_sf_firstentry(sfp);
  1179	
  1180		/*
  1181		 * Need to preserve the existing offset values in the sf directory.
  1182		 * Insert holes (unused entries) where necessary.
  1183		 */
  1184		while (offset < endoffset) {
  1185			/*
  1186			 * sfep is null when we reach the end of the list.
  1187			 */
  1188			if (sfep == NULL)
  1189				newoffset = endoffset;
  1190			else
  1191				newoffset = xfs_dir2_sf_get_offset(sfep);
  1192			/*
  1193			 * There should be a hole here, make one.
  1194			 */
  1195			if (offset < newoffset) {
  1196				dup = bp->b_addr + offset;
  1197				dup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
  1198				dup->length = cpu_to_be16(newoffset - offset);
  1199				*xfs_dir2_data_unused_tag_p(dup) = cpu_to_be16(offset);
  1200				xfs_dir2_data_log_unused(args, bp, dup);
  1201				xfs_dir2_data_freeinsert(hdr,
  1202						xfs_dir2_data_bestfree_p(mp, hdr),
  1203						dup, &dummy);
  1204				offset += be16_to_cpu(dup->length);
  1205				continue;
  1206			}
  1207			/*
  1208			 * Copy a real entry.
  1209			 */
  1210			dep = bp->b_addr + newoffset;
  1211			dep->inumber = cpu_to_be64(xfs_dir2_sf_get_ino(mp, sfp, sfep));
  1212			dep->namelen = sfep->namelen;
  1213			xfs_dir2_data_put_ftype(mp, dep,
  1214					xfs_dir2_sf_get_ftype(mp, sfep));
  1215			memcpy(dep->name, sfep->name, dep->namelen);
  1216			tagp = xfs_dir2_data_entry_tag_p(mp, dep);
  1217			*tagp = cpu_to_be16(newoffset);
  1218			xfs_dir2_data_log_entry(args, bp, dep);
  1219			name.name = sfep->name;
  1220			name.len = sfep->namelen;
> 1221			blp[2 + i].hashval = xfs_dir2_hashname(mp, &name);

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

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

only message in thread, other threads:[~2019-11-11 17:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-11 17:19 [hch-xfs:xfs-remove-dirnameops 2/2] fs/xfs/libxfs/xfs_dir2_block.c:1221:36: sparse: sparse: incorrect type in assignment (different base types) kbuild 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.