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

From: kernel test robot
Date: Fri Nov 20 2020 - 14:43:34 EST


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-rc4 next-20201120]
[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/20201121-001320
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 4d02da974ea85a62074efedf354e82778f910d82
config: arm64-randconfig-s031-20201120 (attached as .config)
compiler: aarch64-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-134-gb59dbdaf-dirty
# https://github.com/0day-ci/linux/commit/af7bf0c625d20c0ebe8b4c180b4422b2a37a9dd5
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/20201121-001320
git checkout af7bf0c625d20c0ebe8b4c180b4422b2a37a9dd5
# 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=arm64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


"sparse warnings: (new ones prefixed by >>)"
>> fs/ntfs3/super.c:1251:34: sparse: sparse: cast to restricted __le16
>> fs/ntfs3/super.c:1251:34: sparse: sparse: cast to restricted __le16
>> fs/ntfs3/super.c:1251:34: sparse: sparse: cast to restricted __le16
>> fs/ntfs3/super.c:1251:34: sparse: sparse: cast to restricted __le16

vim +1251 fs/ntfs3/super.c

c7374db749d575f Konstantin Komarov 2020-11-20 1132
c7374db749d575f Konstantin Komarov 2020-11-20 1133 /* Check bitmap boundary */
c7374db749d575f Konstantin Komarov 2020-11-20 1134 tt = sbi->used.bitmap.nbits;
c7374db749d575f Konstantin Komarov 2020-11-20 1135 if (inode->i_size < bitmap_size(tt)) {
c7374db749d575f Konstantin Komarov 2020-11-20 1136 err = -EINVAL;
c7374db749d575f Konstantin Komarov 2020-11-20 1137 goto out;
c7374db749d575f Konstantin Komarov 2020-11-20 1138 }
c7374db749d575f Konstantin Komarov 2020-11-20 1139
c7374db749d575f Konstantin Komarov 2020-11-20 1140 /* Not necessary */
c7374db749d575f Konstantin Komarov 2020-11-20 1141 sbi->used.bitmap.set_tail = true;
c7374db749d575f Konstantin Komarov 2020-11-20 1142 err = wnd_init(&sbi->used.bitmap, sbi->sb, tt);
c7374db749d575f Konstantin Komarov 2020-11-20 1143 if (err)
c7374db749d575f Konstantin Komarov 2020-11-20 1144 goto out;
c7374db749d575f Konstantin Komarov 2020-11-20 1145
c7374db749d575f Konstantin Komarov 2020-11-20 1146 iput(inode);
c7374db749d575f Konstantin Komarov 2020-11-20 1147
c7374db749d575f Konstantin Komarov 2020-11-20 1148 /* Compute the mft zone */
c7374db749d575f Konstantin Komarov 2020-11-20 1149 err = ntfs_refresh_zone(sbi);
c7374db749d575f Konstantin Komarov 2020-11-20 1150 if (err)
c7374db749d575f Konstantin Komarov 2020-11-20 1151 goto out;
c7374db749d575f Konstantin Komarov 2020-11-20 1152
c7374db749d575f Konstantin Komarov 2020-11-20 1153 /* Load $AttrDef */
c7374db749d575f Konstantin Komarov 2020-11-20 1154 ref.low = cpu_to_le32(MFT_REC_ATTR);
c7374db749d575f Konstantin Komarov 2020-11-20 1155 ref.seq = cpu_to_le16(MFT_REC_ATTR);
c7374db749d575f Konstantin Komarov 2020-11-20 1156 inode = ntfs_iget5(sbi->sb, &ref, &NAME_ATTRDEF);
c7374db749d575f Konstantin Komarov 2020-11-20 1157 if (IS_ERR(inode)) {
c7374db749d575f Konstantin Komarov 2020-11-20 1158 err = PTR_ERR(inode);
c7374db749d575f Konstantin Komarov 2020-11-20 1159 ntfs_err(sb, "Failed to load $AttrDef -> %d", err);
c7374db749d575f Konstantin Komarov 2020-11-20 1160 inode = NULL;
c7374db749d575f Konstantin Komarov 2020-11-20 1161 goto out;
c7374db749d575f Konstantin Komarov 2020-11-20 1162 }
c7374db749d575f Konstantin Komarov 2020-11-20 1163
c7374db749d575f Konstantin Komarov 2020-11-20 1164 if (inode->i_size < sizeof(struct ATTR_DEF_ENTRY)) {
c7374db749d575f Konstantin Komarov 2020-11-20 1165 err = -EINVAL;
c7374db749d575f Konstantin Komarov 2020-11-20 1166 goto out;
c7374db749d575f Konstantin Komarov 2020-11-20 1167 }
c7374db749d575f Konstantin Komarov 2020-11-20 1168 bytes = inode->i_size;
c7374db749d575f Konstantin Komarov 2020-11-20 1169 sbi->def_table = t = ntfs_alloc(bytes, 0);
c7374db749d575f Konstantin Komarov 2020-11-20 1170 if (!t) {
c7374db749d575f Konstantin Komarov 2020-11-20 1171 err = -ENOMEM;
c7374db749d575f Konstantin Komarov 2020-11-20 1172 goto out;
c7374db749d575f Konstantin Komarov 2020-11-20 1173 }
c7374db749d575f Konstantin Komarov 2020-11-20 1174
c7374db749d575f Konstantin Komarov 2020-11-20 1175 for (done = idx = 0; done < bytes; done += PAGE_SIZE, idx++) {
c7374db749d575f Konstantin Komarov 2020-11-20 1176 unsigned long tail = bytes - done;
c7374db749d575f Konstantin Komarov 2020-11-20 1177 struct page *page = ntfs_map_page(inode->i_mapping, idx);
c7374db749d575f Konstantin Komarov 2020-11-20 1178
c7374db749d575f Konstantin Komarov 2020-11-20 1179 if (IS_ERR(page)) {
c7374db749d575f Konstantin Komarov 2020-11-20 1180 err = PTR_ERR(page);
c7374db749d575f Konstantin Komarov 2020-11-20 1181 goto out;
c7374db749d575f Konstantin Komarov 2020-11-20 1182 }
c7374db749d575f Konstantin Komarov 2020-11-20 1183 memcpy(Add2Ptr(t, done), page_address(page),
c7374db749d575f Konstantin Komarov 2020-11-20 1184 min(PAGE_SIZE, tail));
c7374db749d575f Konstantin Komarov 2020-11-20 1185 ntfs_unmap_page(page);
c7374db749d575f Konstantin Komarov 2020-11-20 1186
c7374db749d575f Konstantin Komarov 2020-11-20 1187 if (!idx && ATTR_STD != t->type) {
c7374db749d575f Konstantin Komarov 2020-11-20 1188 err = -EINVAL;
c7374db749d575f Konstantin Komarov 2020-11-20 1189 goto out;
c7374db749d575f Konstantin Komarov 2020-11-20 1190 }
c7374db749d575f Konstantin Komarov 2020-11-20 1191 }
c7374db749d575f Konstantin Komarov 2020-11-20 1192
c7374db749d575f Konstantin Komarov 2020-11-20 1193 t += 1;
c7374db749d575f Konstantin Komarov 2020-11-20 1194 sbi->def_entries = 1;
c7374db749d575f Konstantin Komarov 2020-11-20 1195 done = sizeof(struct ATTR_DEF_ENTRY);
c7374db749d575f Konstantin Komarov 2020-11-20 1196 sbi->reparse.max_size = MAXIMUM_REPARSE_DATA_BUFFER_SIZE;
c7374db749d575f Konstantin Komarov 2020-11-20 1197
c7374db749d575f Konstantin Komarov 2020-11-20 1198 while (done + sizeof(struct ATTR_DEF_ENTRY) <= bytes) {
c7374db749d575f Konstantin Komarov 2020-11-20 1199 u32 t32 = le32_to_cpu(t->type);
c7374db749d575f Konstantin Komarov 2020-11-20 1200
c7374db749d575f Konstantin Komarov 2020-11-20 1201 if ((t32 & 0xF) || le32_to_cpu(t[-1].type) >= t32)
c7374db749d575f Konstantin Komarov 2020-11-20 1202 break;
c7374db749d575f Konstantin Komarov 2020-11-20 1203
c7374db749d575f Konstantin Komarov 2020-11-20 1204 if (t->type == ATTR_REPARSE)
c7374db749d575f Konstantin Komarov 2020-11-20 1205 sbi->reparse.max_size = le64_to_cpu(t->max_sz);
c7374db749d575f Konstantin Komarov 2020-11-20 1206
c7374db749d575f Konstantin Komarov 2020-11-20 1207 done += sizeof(struct ATTR_DEF_ENTRY);
c7374db749d575f Konstantin Komarov 2020-11-20 1208 t += 1;
c7374db749d575f Konstantin Komarov 2020-11-20 1209 sbi->def_entries += 1;
c7374db749d575f Konstantin Komarov 2020-11-20 1210 }
c7374db749d575f Konstantin Komarov 2020-11-20 1211 iput(inode);
c7374db749d575f Konstantin Komarov 2020-11-20 1212
c7374db749d575f Konstantin Komarov 2020-11-20 1213 /* Load $UpCase */
c7374db749d575f Konstantin Komarov 2020-11-20 1214 ref.low = cpu_to_le32(MFT_REC_UPCASE);
c7374db749d575f Konstantin Komarov 2020-11-20 1215 ref.seq = cpu_to_le16(MFT_REC_UPCASE);
c7374db749d575f Konstantin Komarov 2020-11-20 1216 inode = ntfs_iget5(sb, &ref, &NAME_UPCASE);
c7374db749d575f Konstantin Komarov 2020-11-20 1217 if (IS_ERR(inode)) {
c7374db749d575f Konstantin Komarov 2020-11-20 1218 err = PTR_ERR(inode);
c7374db749d575f Konstantin Komarov 2020-11-20 1219 ntfs_err(sb, "Failed to load $LogFile.");
c7374db749d575f Konstantin Komarov 2020-11-20 1220 inode = NULL;
c7374db749d575f Konstantin Komarov 2020-11-20 1221 goto out;
c7374db749d575f Konstantin Komarov 2020-11-20 1222 }
c7374db749d575f Konstantin Komarov 2020-11-20 1223
c7374db749d575f Konstantin Komarov 2020-11-20 1224 ni = ntfs_i(inode);
c7374db749d575f Konstantin Komarov 2020-11-20 1225
c7374db749d575f Konstantin Komarov 2020-11-20 1226 if (inode->i_size != 0x10000 * sizeof(short)) {
c7374db749d575f Konstantin Komarov 2020-11-20 1227 err = -EINVAL;
c7374db749d575f Konstantin Komarov 2020-11-20 1228 goto out;
c7374db749d575f Konstantin Komarov 2020-11-20 1229 }
c7374db749d575f Konstantin Komarov 2020-11-20 1230
c7374db749d575f Konstantin Komarov 2020-11-20 1231 sbi->upcase = upcase = ntfs_alloc(0x10000 * sizeof(short), 0);
c7374db749d575f Konstantin Komarov 2020-11-20 1232 if (!upcase) {
c7374db749d575f Konstantin Komarov 2020-11-20 1233 err = -ENOMEM;
c7374db749d575f Konstantin Komarov 2020-11-20 1234 goto out;
c7374db749d575f Konstantin Komarov 2020-11-20 1235 }
c7374db749d575f Konstantin Komarov 2020-11-20 1236
c7374db749d575f Konstantin Komarov 2020-11-20 1237 for (idx = 0; idx < (0x10000 * sizeof(short) >> PAGE_SHIFT); idx++) {
c7374db749d575f Konstantin Komarov 2020-11-20 1238 const u16 *src;
c7374db749d575f Konstantin Komarov 2020-11-20 1239 u16 *dst = Add2Ptr(upcase, idx << PAGE_SHIFT);
c7374db749d575f Konstantin Komarov 2020-11-20 1240 struct page *page = ntfs_map_page(inode->i_mapping, idx);
c7374db749d575f Konstantin Komarov 2020-11-20 1241
c7374db749d575f Konstantin Komarov 2020-11-20 1242 if (IS_ERR(page)) {
c7374db749d575f Konstantin Komarov 2020-11-20 1243 err = PTR_ERR(page);
c7374db749d575f Konstantin Komarov 2020-11-20 1244 goto out;
c7374db749d575f Konstantin Komarov 2020-11-20 1245 }
c7374db749d575f Konstantin Komarov 2020-11-20 1246
c7374db749d575f Konstantin Komarov 2020-11-20 1247 src = page_address(page);
c7374db749d575f Konstantin Komarov 2020-11-20 1248
c7374db749d575f Konstantin Komarov 2020-11-20 1249 #ifdef __BIG_ENDIAN
c7374db749d575f Konstantin Komarov 2020-11-20 1250 for (i = 0; i < PAGE_SIZE / sizeof(u16); i++)
c7374db749d575f Konstantin Komarov 2020-11-20 @1251 *dst++ = le16_to_cpu(*src++);
c7374db749d575f Konstantin Komarov 2020-11-20 1252 #else
c7374db749d575f Konstantin Komarov 2020-11-20 1253 memcpy(dst, src, PAGE_SIZE);
c7374db749d575f Konstantin Komarov 2020-11-20 1254 #endif
c7374db749d575f Konstantin Komarov 2020-11-20 1255 ntfs_unmap_page(page);
c7374db749d575f Konstantin Komarov 2020-11-20 1256 }
c7374db749d575f Konstantin Komarov 2020-11-20 1257
c7374db749d575f Konstantin Komarov 2020-11-20 1258 shared = ntfs_set_shared(upcase, 0x10000 * sizeof(short));
c7374db749d575f Konstantin Komarov 2020-11-20 1259 if (shared && upcase != shared) {
c7374db749d575f Konstantin Komarov 2020-11-20 1260 sbi->upcase = shared;
c7374db749d575f Konstantin Komarov 2020-11-20 1261 ntfs_free(upcase);
c7374db749d575f Konstantin Komarov 2020-11-20 1262 }
c7374db749d575f Konstantin Komarov 2020-11-20 1263
c7374db749d575f Konstantin Komarov 2020-11-20 1264 iput(inode);
c7374db749d575f Konstantin Komarov 2020-11-20 1265 inode = NULL;
c7374db749d575f Konstantin Komarov 2020-11-20 1266
c7374db749d575f Konstantin Komarov 2020-11-20 1267 if (is_ntfs3(sbi)) {
c7374db749d575f Konstantin Komarov 2020-11-20 1268 /* Load $Secure */
c7374db749d575f Konstantin Komarov 2020-11-20 1269 err = ntfs_security_init(sbi);
c7374db749d575f Konstantin Komarov 2020-11-20 1270 if (err)
c7374db749d575f Konstantin Komarov 2020-11-20 1271 goto out;
c7374db749d575f Konstantin Komarov 2020-11-20 1272
c7374db749d575f Konstantin Komarov 2020-11-20 1273 /* Load $Extend */
c7374db749d575f Konstantin Komarov 2020-11-20 1274 err = ntfs_extend_init(sbi);
c7374db749d575f Konstantin Komarov 2020-11-20 1275 if (err)
c7374db749d575f Konstantin Komarov 2020-11-20 1276 goto load_root;
c7374db749d575f Konstantin Komarov 2020-11-20 1277
c7374db749d575f Konstantin Komarov 2020-11-20 1278 /* Load $Extend\$Reparse */
c7374db749d575f Konstantin Komarov 2020-11-20 1279 err = ntfs_reparse_init(sbi);
c7374db749d575f Konstantin Komarov 2020-11-20 1280 if (err)
c7374db749d575f Konstantin Komarov 2020-11-20 1281 goto load_root;
c7374db749d575f Konstantin Komarov 2020-11-20 1282
c7374db749d575f Konstantin Komarov 2020-11-20 1283 /* Load $Extend\$ObjId */
c7374db749d575f Konstantin Komarov 2020-11-20 1284 err = ntfs_objid_init(sbi);
c7374db749d575f Konstantin Komarov 2020-11-20 1285 if (err)
c7374db749d575f Konstantin Komarov 2020-11-20 1286 goto load_root;
c7374db749d575f Konstantin Komarov 2020-11-20 1287 }
c7374db749d575f Konstantin Komarov 2020-11-20 1288
c7374db749d575f Konstantin Komarov 2020-11-20 1289 load_root:
c7374db749d575f Konstantin Komarov 2020-11-20 1290
c7374db749d575f Konstantin Komarov 2020-11-20 1291 /* Load root */
c7374db749d575f Konstantin Komarov 2020-11-20 1292 ref.low = cpu_to_le32(MFT_REC_ROOT);
c7374db749d575f Konstantin Komarov 2020-11-20 1293 ref.seq = cpu_to_le16(MFT_REC_ROOT);
c7374db749d575f Konstantin Komarov 2020-11-20 1294 inode = ntfs_iget5(sb, &ref, &NAME_ROOT);
c7374db749d575f Konstantin Komarov 2020-11-20 1295 if (IS_ERR(inode)) {
c7374db749d575f Konstantin Komarov 2020-11-20 1296 err = PTR_ERR(inode);
c7374db749d575f Konstantin Komarov 2020-11-20 1297 ntfs_err(sb, "Failed to load root.");
c7374db749d575f Konstantin Komarov 2020-11-20 1298 inode = NULL;
c7374db749d575f Konstantin Komarov 2020-11-20 1299 goto out;
c7374db749d575f Konstantin Komarov 2020-11-20 1300 }
c7374db749d575f Konstantin Komarov 2020-11-20 1301
c7374db749d575f Konstantin Komarov 2020-11-20 1302 ni = ntfs_i(inode);
c7374db749d575f Konstantin Komarov 2020-11-20 1303
c7374db749d575f Konstantin Komarov 2020-11-20 1304 sb->s_root = d_make_root(inode);
c7374db749d575f Konstantin Komarov 2020-11-20 1305
c7374db749d575f Konstantin Komarov 2020-11-20 1306 if (!sb->s_root) {
c7374db749d575f Konstantin Komarov 2020-11-20 1307 err = -EINVAL;
c7374db749d575f Konstantin Komarov 2020-11-20 1308 goto out;
c7374db749d575f Konstantin Komarov 2020-11-20 1309 }
c7374db749d575f Konstantin Komarov 2020-11-20 1310
c7374db749d575f Konstantin Komarov 2020-11-20 1311 return 0;
c7374db749d575f Konstantin Komarov 2020-11-20 1312
c7374db749d575f Konstantin Komarov 2020-11-20 1313 out:
c7374db749d575f Konstantin Komarov 2020-11-20 1314 iput(inode);
c7374db749d575f Konstantin Komarov 2020-11-20 1315
c7374db749d575f Konstantin Komarov 2020-11-20 1316 if (sb->s_root) {
c7374db749d575f Konstantin Komarov 2020-11-20 1317 d_drop(sb->s_root);
c7374db749d575f Konstantin Komarov 2020-11-20 1318 sb->s_root = NULL;
c7374db749d575f Konstantin Komarov 2020-11-20 1319 }
c7374db749d575f Konstantin Komarov 2020-11-20 1320
c7374db749d575f Konstantin Komarov 2020-11-20 1321 put_ntfs(sbi);
c7374db749d575f Konstantin Komarov 2020-11-20 1322
c7374db749d575f Konstantin Komarov 2020-11-20 1323 sb->s_fs_info = NULL;
c7374db749d575f Konstantin Komarov 2020-11-20 1324 return err;
c7374db749d575f Konstantin Komarov 2020-11-20 1325 }
c7374db749d575f Konstantin Komarov 2020-11-20 1326

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip