Re: [PATCH] fs/file.c: tidy up close_files

From: kbuild test robot
Date: Thu Oct 08 2015 - 15:10:29 EST


Hi Mateusz,

[auto build test WARNING on v4.3-rc4 -- if it's inappropriate base, please ignore]

reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

fs/file.c:321:17: sparse: incorrect type in assignment (different address spaces)
fs/file.c:321:17: expected struct file **old_fds
fs/file.c:321:17: got struct file [noderef] <asn:4>**fd
fs/file.c:322:17: sparse: incorrect type in assignment (different address spaces)
fs/file.c:322:17: expected struct file **new_fds
fs/file.c:322:17: got struct file [noderef] <asn:4>**fd
>> fs/file.c:387:43: sparse: incorrect type in argument 1 (different address spaces)
fs/file.c:387:43: expected struct file *<noident>
fs/file.c:387:43: got struct file [noderef] <asn:4>*<noident>
fs/file.c:446:28: sparse: incorrect type in initializer (different address spaces)
fs/file.c:446:28: expected struct fdtable [noderef] <asn:4>*fdt
fs/file.c:446:28: got struct fdtable [toplevel] *<noident>
fs/file.c:606:14: sparse: incorrect type in assignment (different address spaces)
fs/file.c:606:14: expected struct file *file
fs/file.c:606:14: got struct file [noderef] <asn:4>*<noident>
fs/file.c:641:30: sparse: incorrect type in assignment (different address spaces)
fs/file.c:641:30: expected struct file *file
fs/file.c:641:30: got struct file [noderef] <asn:4>*<noident>
fs/file.c:802:16: sparse: incorrect type in assignment (different address spaces)
fs/file.c:802:16: expected struct file *tofree
fs/file.c:802:16: got struct file [noderef] <asn:4>*<noident>

vim +387 fs/file.c

371 * It is safe to dereference the fd table without RCU or
372 * ->file_lock because this is the last reference to the
373 * files structure.
374 */
375 struct fdtable *fdt = rcu_dereference_raw(files->fdt);
376 unsigned i;
377
378 for (i = 0; ; i++) {
379 unsigned long set;
380 unsigned fd = i * BITS_PER_LONG;
381 if (fd >= fdt->max_fds)
382 break;
383 set = fdt->open_fds[i];
384 for ( ; set ; fd++, set >>= 1) {
385 if (!(set & 1))
386 continue;
> 387 filp_close(fdt->fd[fd], files);
388 cond_resched_rcu_qs();
389 }
390 }
391
392 return fdt;
393 }
394
395 struct files_struct *get_files_struct(struct task_struct *task)

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/