All of lore.kernel.org
 help / color / mirror / Atom feed
* 1 New compile/sparse warning (overnight build)
@ 2004-09-29 17:22 John Cherry
  2004-09-29 17:33 ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: John Cherry @ 2004-09-29 17:22 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org

This sparse warning was introduced with patch 1.2000 (axboe).
In fs/bio.c (line 509),

	if (copy_from_user(addr, (char *) p, bvec->bv_len))

should probably be

	if (copy_from_user(addr, (char __user *) p, bvec->bv_len))

John

--------------------------------------------------------------

Compiler: gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Arch: i386


Summary:
   New warnings = 1
   Fixed warnings = 3

New warnings:
-------------
fs/bio.c:509:30: warning: incorrect type in argument 2 (different
address spaces)
fs/bio.c:509:30:    expected void const [noderef] *from<asn:1>
fs/bio.c:509:30:    got char *<noident>


Fixed warnings:
---------------
fs/bio.c:392:20: warning: incorrect type in argument 1 (different
address spaces)
fs/bio.c:392:20:    expected void [noderef] *to<asn:1>
fs/bio.c:392:20:    got char *uaddr

fs/bio.c:462:31: warning: incorrect type in argument 2 (different
address spaces)
fs/bio.c:462:31:    expected void const [noderef] *from<asn:1>
fs/bio.c:462:31:    got char *<noident>

kernel/sys.c:1737:34: warning: incorrect type in argument 2 (different
address spaces)
kernel/sys.c:1737:34:    expected char const [noderef] *src<asn:1>
kernel/sys.c:1737:34:    got char *<noident>




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

* Re: 1 New compile/sparse warning (overnight build)
  2004-09-29 17:22 1 New compile/sparse warning (overnight build) John Cherry
@ 2004-09-29 17:33 ` Jens Axboe
  2004-09-29 17:51   ` John Cherry
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2004-09-29 17:33 UTC (permalink / raw)
  To: John Cherry; +Cc: linux-kernel@vger.kernel.org

On Wed, Sep 29 2004, John Cherry wrote:
> This sparse warning was introduced with patch 1.2000 (axboe).
> In fs/bio.c (line 509),
> 
> 	if (copy_from_user(addr, (char *) p, bvec->bv_len))
> 
> should probably be
> 
> 	if (copy_from_user(addr, (char __user *) p, bvec->bv_len))

It's not a new warning, just look at your own generated output:

> New warnings:
> -------------
> fs/bio.c:509:30: warning: incorrect type in argument 2 (different
> address spaces)
> fs/bio.c:509:30:    expected void const [noderef] *from<asn:1>
> fs/bio.c:509:30:    got char *<noident>
> 
> 
> Fixed warnings:
> ---------------
> fs/bio.c:462:31: warning: incorrect type in argument 2 (different
> address spaces)
> fs/bio.c:462:31:    expected void const [noderef] *from<asn:1>
> fs/bio.c:462:31:    got char *<noident>

The warning simply moved. This should fix it, though.

Signed-off-by: Jens Axboe <axboe@suse.de>

===== fs/bio.c 1.67 vs edited =====
--- 1.67/fs/bio.c	2004-09-28 17:59:14 +02:00
+++ edited/fs/bio.c	2004-09-29 19:34:39 +02:00
@@ -497,7 +497,7 @@
 	 * success
 	 */
 	if (!write_to_vm) {
-		unsigned long p = uaddr;
+		char __user *p = (char __user *) uaddr;
 
 		/*
 		 * for a write, copy in data to kernel pages
@@ -506,7 +506,7 @@
 		bio_for_each_segment(bvec, bio, i) {
 			char *addr = page_address(bvec->bv_page);
 
-			if (copy_from_user(addr, (char *) p, bvec->bv_len))
+			if (copy_from_user(addr, p, bvec->bv_len))
 				goto cleanup;
 			p += bvec->bv_len;
 		}

-- 
Jens Axboe


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

* Re: 1 New compile/sparse warning (overnight build)
  2004-09-29 17:33 ` Jens Axboe
@ 2004-09-29 17:51   ` John Cherry
  0 siblings, 0 replies; 3+ messages in thread
From: John Cherry @ 2004-09-29 17:51 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel@vger.kernel.org

On Wed, 2004-09-29 at 10:33, Jens Axboe wrote:
> On Wed, Sep 29 2004, John Cherry wrote:
> > This sparse warning was introduced with patch 1.2000 (axboe).
> > In fs/bio.c (line 509),
> > 
> > 	if (copy_from_user(addr, (char *) p, bvec->bv_len))
> > 
> > should probably be
> > 
> > 	if (copy_from_user(addr, (char __user *) p, bvec->bv_len))
> 
> It's not a new warning, just look at your own generated output:

Yes, this bug just moved.  Thanks for the fix.

John

> 
> > New warnings:
> > -------------
> > fs/bio.c:509:30: warning: incorrect type in argument 2 (different
> > address spaces)
> > fs/bio.c:509:30:    expected void const [noderef] *from<asn:1>
> > fs/bio.c:509:30:    got char *<noident>
> > 
> > 
> > Fixed warnings:
> > ---------------
> > fs/bio.c:462:31: warning: incorrect type in argument 2 (different
> > address spaces)
> > fs/bio.c:462:31:    expected void const [noderef] *from<asn:1>
> > fs/bio.c:462:31:    got char *<noident>
> 
> The warning simply moved. This should fix it, though.
> 
> Signed-off-by: Jens Axboe <axboe@suse.de>
> 
> ===== fs/bio.c 1.67 vs edited =====
> --- 1.67/fs/bio.c	2004-09-28 17:59:14 +02:00
> +++ edited/fs/bio.c	2004-09-29 19:34:39 +02:00
> @@ -497,7 +497,7 @@
>  	 * success
>  	 */
>  	if (!write_to_vm) {
> -		unsigned long p = uaddr;
> +		char __user *p = (char __user *) uaddr;
>  
>  		/*
>  		 * for a write, copy in data to kernel pages
> @@ -506,7 +506,7 @@
>  		bio_for_each_segment(bvec, bio, i) {
>  			char *addr = page_address(bvec->bv_page);
>  
> -			if (copy_from_user(addr, (char *) p, bvec->bv_len))
> +			if (copy_from_user(addr, p, bvec->bv_len))
>  				goto cleanup;
>  			p += bvec->bv_len;
>  		}


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

end of thread, other threads:[~2004-09-29 17:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-29 17:22 1 New compile/sparse warning (overnight build) John Cherry
2004-09-29 17:33 ` Jens Axboe
2004-09-29 17:51   ` John Cherry

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.