All of lore.kernel.org
 help / color / mirror / Atom feed
* fs/proc/task_nommu.c:67:55: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2020-05-24 14:59 ` kbuild test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2020-05-24 14:59 UTC (permalink / raw)
  To: kbuild-all

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

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@intel.com>


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@intel.com>
:::::: CC: Ingo Molnar <mingo@kernel.org>

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 27607 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* fs/proc/task_nommu.c:67:55: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2020-05-24 14:59 ` kbuild test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2020-05-24 14:59 UTC (permalink / raw)
  To: Madhuparna Bhowmik; +Cc: kbuild-all, linux-kernel, Christian Brauner

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

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@intel.com>


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@intel.com>
:::::: CC: Ingo Molnar <mingo@kernel.org>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27607 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: fs/proc/task_nommu.c:67:55: sparse: sparse: incorrect type in argument 1 (different address spaces)
       [not found] <20200524190415.zb5v5dlp6jxhb42y@ltop.local>
@ 2020-05-25  0:08 ` Philip Li
  0 siblings, 0 replies; 3+ messages in thread
From: Philip Li @ 2020-05-25  0:08 UTC (permalink / raw)
  To: kbuild-all

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

On Sun, May 24, 2020 at 09:04:15PM +0200, Luc Van Oostenryck wrote:
> Hi,
> 
> I'm wondering why Sparse error/warning messages are often subtly
> corrupted. For exemple:
> 
> > 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 @@
> 
> The ending part "got sstruct" is wrong, parse correctly emits "got struct".
> 
> > >> 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 @@
> 
> It's wrong here too: "got struct sighand_struct [noderevoid const *objp"
> It looks like starting with the 'expected' part and ending with the 'got' part.
> 
> It's not something new but I never bothered to repport.
> It only happens with the part prefixed by '>>', I've never seen this sort of
> corruption in the other parts.
Thanks Luc for pointing out this, we will fix this in earliest time
to make report correct.

> 
> It's maybe related to some substitution that is made to replace ": warning:"
> or ": error:" by ": sparse:" but since the flag -fdiagnostic-prefix is used
> the result is the redundant ": sparse: sparse:". 
Thanks for the hint, we will check code logic.

> 
> Best regards,
> -- Luc Van Oostenryck (sparse's maintainer)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-25  0:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20200524190415.zb5v5dlp6jxhb42y@ltop.local>
2020-05-25  0:08 ` fs/proc/task_nommu.c:67:55: sparse: sparse: incorrect type in argument 1 (different address spaces) Philip Li
2020-05-24 14:59 kbuild test robot
2020-05-24 14:59 ` 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.