fs/proc/task_nommu.c:67:55: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kbuild test robot
Date: Sun May 24 2020 - 11:03:00 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: caffb99b6929f41a69edbb5aef3a359bf45f3315
commit: 913292c97d750fe4188b4f5aa770e5e0ca1e5a91 sched.h: Annotate sighand_struct with __rcu
date: 4 months ago
config: c6x-randconfig-s002-20200524 (attached as .config)
compiler: c6x-elf-gcc (GCC) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-193-gb8fad4bc-dirty
git checkout 913292c97d750fe4188b4f5aa770e5e0ca1e5a91
# save the attached .config to linux build tree
make W=1 C=1 ARCH=c6x CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

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


sparse warnings: (new ones prefixed by >>)

>> fs/proc/task_nommu.c:67:55: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct refcount_struct const [usertype] *r @@ got sstruct refcount_struct const [usertype] *r @@
fs/proc/task_nommu.c:67:55: sparse: expected struct refcount_struct const [usertype] *r
fs/proc/task_nommu.c:67:55: sparse: got struct refcount_struct [noderef] <asn:4> *
>> fs/proc/task_nommu.c:68:43: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *objp @@ got struct sighand_struct [noderevoid const *objp @@
fs/proc/task_nommu.c:68:43: sparse: expected void const *objp
fs/proc/task_nommu.c:68:43: sparse: got struct sighand_struct [noderef] <asn:4> *sighand
fs/proc/task_nommu.c:70:42: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *objp @@ got struct sighand_struct [noderevoid const *objp @@
fs/proc/task_nommu.c:70:42: sparse: expected void const *objp
fs/proc/task_nommu.c:70:42: sparse: got struct sighand_struct [noderef] <asn:4> *sighand

vim +67 fs/proc/task_nommu.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 14
^1da177e4c3f41 Linus Torvalds 2005-04-16 15 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 16 * Logic: we've got two memory sums for each process, "shared", and
025dfdafe77f20 Frederik Schwarzer 2008-10-16 17 * "non-shared". Shared memory may get counted more than once, for
^1da177e4c3f41 Linus Torvalds 2005-04-16 18 * each process that owns it. Non-shared memory is counted
^1da177e4c3f41 Linus Torvalds 2005-04-16 19 * accurately.
^1da177e4c3f41 Linus Torvalds 2005-04-16 20 */
df5f8314ca30d6 Eric W. Biederman 2008-02-08 21 void task_mem(struct seq_file *m, struct mm_struct *mm)
^1da177e4c3f41 Linus Torvalds 2005-04-16 22 {
8feae13110d60c David Howells 2009-01-08 23 struct vm_area_struct *vma;
38f714795b7cf4 David Howells 2009-01-08 24 struct vm_region *region;
8feae13110d60c David Howells 2009-01-08 25 struct rb_node *p;
38f714795b7cf4 David Howells 2009-01-08 26 unsigned long bytes = 0, sbytes = 0, slack = 0, size;
^1da177e4c3f41 Linus Torvalds 2005-04-16 27
^1da177e4c3f41 Linus Torvalds 2005-04-16 28 down_read(&mm->mmap_sem);
8feae13110d60c David Howells 2009-01-08 29 for (p = rb_first(&mm->mm_rb); p; p = rb_next(p)) {
8feae13110d60c David Howells 2009-01-08 30 vma = rb_entry(p, struct vm_area_struct, vm_rb);
^1da177e4c3f41 Linus Torvalds 2005-04-16 31
8feae13110d60c David Howells 2009-01-08 32 bytes += kobjsize(vma);
38f714795b7cf4 David Howells 2009-01-08 33
38f714795b7cf4 David Howells 2009-01-08 34 region = vma->vm_region;
38f714795b7cf4 David Howells 2009-01-08 35 if (region) {
38f714795b7cf4 David Howells 2009-01-08 36 size = kobjsize(region);
38f714795b7cf4 David Howells 2009-01-08 37 size += region->vm_end - region->vm_start;
38f714795b7cf4 David Howells 2009-01-08 38 } else {
38f714795b7cf4 David Howells 2009-01-08 39 size = vma->vm_end - vma->vm_start;
38f714795b7cf4 David Howells 2009-01-08 40 }
38f714795b7cf4 David Howells 2009-01-08 41
^1da177e4c3f41 Linus Torvalds 2005-04-16 42 if (atomic_read(&mm->mm_count) > 1 ||
8feae13110d60c David Howells 2009-01-08 43 vma->vm_flags & VM_MAYSHARE) {
38f714795b7cf4 David Howells 2009-01-08 44 sbytes += size;
^1da177e4c3f41 Linus Torvalds 2005-04-16 45 } else {
38f714795b7cf4 David Howells 2009-01-08 46 bytes += size;
38f714795b7cf4 David Howells 2009-01-08 47 if (region)
38f714795b7cf4 David Howells 2009-01-08 48 slack = region->vm_end - vma->vm_end;
^1da177e4c3f41 Linus Torvalds 2005-04-16 49 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 50 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 51
^1da177e4c3f41 Linus Torvalds 2005-04-16 52 if (atomic_read(&mm->mm_count) > 1)
^1da177e4c3f41 Linus Torvalds 2005-04-16 53 sbytes += kobjsize(mm);
^1da177e4c3f41 Linus Torvalds 2005-04-16 54 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 55 bytes += kobjsize(mm);
^1da177e4c3f41 Linus Torvalds 2005-04-16 56
498052bba55eca Al Viro 2009-03-30 57 if (current->fs && current->fs->users > 1)
^1da177e4c3f41 Linus Torvalds 2005-04-16 58 sbytes += kobjsize(current->fs);
^1da177e4c3f41 Linus Torvalds 2005-04-16 59 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 60 bytes += kobjsize(current->fs);
^1da177e4c3f41 Linus Torvalds 2005-04-16 61
^1da177e4c3f41 Linus Torvalds 2005-04-16 62 if (current->files && atomic_read(&current->files->count) > 1)
^1da177e4c3f41 Linus Torvalds 2005-04-16 63 sbytes += kobjsize(current->files);
^1da177e4c3f41 Linus Torvalds 2005-04-16 64 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 65 bytes += kobjsize(current->files);
^1da177e4c3f41 Linus Torvalds 2005-04-16 66
d036bda7d0e726 Elena Reshetova 2019-01-18 @67 if (current->sighand && refcount_read(&current->sighand->count) > 1)
^1da177e4c3f41 Linus Torvalds 2005-04-16 @68 sbytes += kobjsize(current->sighand);
^1da177e4c3f41 Linus Torvalds 2005-04-16 69 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 70 bytes += kobjsize(current->sighand);
^1da177e4c3f41 Linus Torvalds 2005-04-16 71
^1da177e4c3f41 Linus Torvalds 2005-04-16 72 bytes += kobjsize(current); /* includes kernel stack */
^1da177e4c3f41 Linus Torvalds 2005-04-16 73
df5f8314ca30d6 Eric W. Biederman 2008-02-08 74 seq_printf(m,
^1da177e4c3f41 Linus Torvalds 2005-04-16 75 "Mem:\t%8lu bytes\n"
^1da177e4c3f41 Linus Torvalds 2005-04-16 76 "Slack:\t%8lu bytes\n"
^1da177e4c3f41 Linus Torvalds 2005-04-16 77 "Shared:\t%8lu bytes\n",
^1da177e4c3f41 Linus Torvalds 2005-04-16 78 bytes, slack, sbytes);
^1da177e4c3f41 Linus Torvalds 2005-04-16 79
^1da177e4c3f41 Linus Torvalds 2005-04-16 80 up_read(&mm->mmap_sem);
^1da177e4c3f41 Linus Torvalds 2005-04-16 81 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 82

:::::: The code at line 67 was first introduced by commit
:::::: d036bda7d0e7269c2982eb979acfef855f5d7977 sched/core: Convert sighand_struct.count to refcount_t

:::::: TO: Elena Reshetova <elena.reshetova@xxxxxxxxx>
:::::: CC: Ingo Molnar <mingo@xxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip