All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Andres Lagar-Cavilla <andreslc@gridcentric.ca>
Cc: kernel-janitors@vger.kernel.org,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	xen-devel@lists.xensource.com,
	virtualization@lists.linux-foundation.org,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [patch 3/3 v2] xen/privcmd: add a __user annotation to a cast
Date: Mon, 10 Sep 2012 10:21:07 +0000	[thread overview]
Message-ID: <20120910102107.GA27456@mwanda> (raw)
In-Reply-To: <504DC8FE020000780009A190@nat28.tlf.novell.com>

Sparse complains that we lose the __user annotation in the cast here.

drivers/xen/privcmd.c:388:35: warning: cast removes address space of expression
drivers/xen/privcmd.c:388:32: warning: incorrect type in assignment (different address spaces)
drivers/xen/privcmd.c:388:32:    expected unsigned long [noderef] [usertype] <asn:1>*[addressable] [assigned] user_mfn
drivers/xen/privcmd.c:388:32:    got unsigned long [usertype] *<noident>

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: In v1 I removed the const from the declaration but now I just removed it
from the cast.  This data can either be a v1 or a v2 type struct.  The m.arr
data is const in version 2 but not in version 1.

diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
index 0ce006a..fceb83e 100644
--- a/drivers/xen/privcmd.c
+++ b/drivers/xen/privcmd.c
@@ -389,7 +389,7 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version)
 
 	if (state.global_error && (version = 1)) {
 		/* Write back errors in second pass. */
-		state.user_mfn = (xen_pfn_t *)m.arr;
+		state.user_mfn = (xen_pfn_t __user *)m.arr;
 		state.err      = err_array;
 		ret = traverse_pages(m.num, sizeof(xen_pfn_t),
 				     &pagelist, mmap_return_errors_v1, &state);

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Andres Lagar-Cavilla <andreslc@gridcentric.ca>
Cc: kernel-janitors@vger.kernel.org,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	xen-devel@lists.xensource.com,
	virtualization@lists.linux-foundation.org,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [patch 3/3 v2] xen/privcmd: add a __user annotation to a cast
Date: Mon, 10 Sep 2012 13:21:07 +0300	[thread overview]
Message-ID: <20120910102107.GA27456@mwanda> (raw)
In-Reply-To: <504DC8FE020000780009A190@nat28.tlf.novell.com>

Sparse complains that we lose the __user annotation in the cast here.

drivers/xen/privcmd.c:388:35: warning: cast removes address space of expression
drivers/xen/privcmd.c:388:32: warning: incorrect type in assignment (different address spaces)
drivers/xen/privcmd.c:388:32:    expected unsigned long [noderef] [usertype] <asn:1>*[addressable] [assigned] user_mfn
drivers/xen/privcmd.c:388:32:    got unsigned long [usertype] *<noident>

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: In v1 I removed the const from the declaration but now I just removed it
from the cast.  This data can either be a v1 or a v2 type struct.  The m.arr
data is const in version 2 but not in version 1.

diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
index 0ce006a..fceb83e 100644
--- a/drivers/xen/privcmd.c
+++ b/drivers/xen/privcmd.c
@@ -389,7 +389,7 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version)
 
 	if (state.global_error && (version == 1)) {
 		/* Write back errors in second pass. */
-		state.user_mfn = (xen_pfn_t *)m.arr;
+		state.user_mfn = (xen_pfn_t __user *)m.arr;
 		state.err      = err_array;
 		ret = traverse_pages(m.num, sizeof(xen_pfn_t),
 				     &pagelist, mmap_return_errors_v1, &state);

  reply	other threads:[~2012-09-10 10:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-08  9:58 [patch 3/3] xen/privcmd: remove const modifier from declaration Dan Carpenter
2012-09-08  9:58 ` Dan Carpenter
2012-09-09 19:50 ` Andres Lagar-Cavilla
2012-09-09 19:50   ` Andres Lagar-Cavilla
2012-09-09 19:50 ` Andres Lagar-Cavilla
2012-09-10  9:03 ` [Xen-devel] " Jan Beulich
2012-09-10  9:03   ` Jan Beulich
2012-09-10 10:21   ` Dan Carpenter [this message]
2012-09-10 10:21     ` [patch 3/3 v2] xen/privcmd: add a __user annotation to a cast Dan Carpenter
2012-09-10 10:43   ` [Xen-devel] [patch 3/3] xen/privcmd: remove const modifier from declaration David Vrabel
2012-09-10 10:43     ` David Vrabel
2012-09-10 10:43   ` [Xen-devel] " David Vrabel
2012-09-10  9:03 ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120910102107.GA27456@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=andreslc@gridcentric.ca \
    --cc=jeremy@goop.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=konrad.wilk@oracle.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.