mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: boris.ostrovsky@oracle.com
Cc: sstabellini@kernel.org, xen-devel@lists.xen.org,
	linux-kernel@vger.kernel.org, jgross@suse.com,
	stefano@aporeto.com
Subject: [PATCH 2/2] pvcalls: fix casts to avoid warnings on 32 bit
Date: Mon, 30 Oct 2017 14:40:11 -0700	[thread overview]
Message-ID: <1509399611-12503-2-git-send-email-sstabellini@kernel.org> (raw)
In-Reply-To: <1509399611-12503-1-git-send-email-sstabellini@kernel.org>

Cast the map pointers to uintptr_t instead of uint64_t everywhere when
setting the socket ids.

In pvcalls_front_event_handler, first cast the poll id to uintptr_t,
then to struct sock_mapping * to avoid warnings. We know that the poll
id is fine because it is was set by the frontend initially in the poll
request.

Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
---
 drivers/xen/pvcalls-front.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/xen/pvcalls-front.c b/drivers/xen/pvcalls-front.c
index f2dcac88..0c1ec68 100644
--- a/drivers/xen/pvcalls-front.c
+++ b/drivers/xen/pvcalls-front.c
@@ -157,7 +157,7 @@ static irqreturn_t pvcalls_front_event_handler(int irq, void *dev_id)
 
 		req_id = rsp->req_id;
 		if (rsp->cmd == PVCALLS_POLL) {
-			struct sock_mapping *map = (struct sock_mapping *)
+			struct sock_mapping *map = (struct sock_mapping *)(uintptr_t)
 						   rsp->u.poll.id;
 
 			clear_bit(PVCALLS_FLAG_POLL_INFLIGHT,
@@ -280,7 +280,7 @@ int pvcalls_front_socket(struct socket *sock)
 	req = RING_GET_REQUEST(&bedata->ring, req_id);
 	req->req_id = req_id;
 	req->cmd = PVCALLS_SOCKET;
-	req->u.socket.id = (uint64_t) map;
+	req->u.socket.id = (uintptr_t) map;
 	req->u.socket.domain = AF_INET;
 	req->u.socket.type = SOCK_STREAM;
 	req->u.socket.protocol = IPPROTO_IP;
@@ -402,7 +402,7 @@ int pvcalls_front_connect(struct socket *sock, struct sockaddr *addr,
 	req = RING_GET_REQUEST(&bedata->ring, req_id);
 	req->req_id = req_id;
 	req->cmd = PVCALLS_CONNECT;
-	req->u.connect.id = (uint64_t)map;
+	req->u.connect.id = (uintptr_t)map;
 	req->u.connect.len = addr_len;
 	req->u.connect.flags = flags;
 	req->u.connect.ref = map->active.ref;
@@ -663,7 +663,7 @@ int pvcalls_front_bind(struct socket *sock, struct sockaddr *addr, int addr_len)
 	req->req_id = req_id;
 	map->sock = sock;
 	req->cmd = PVCALLS_BIND;
-	req->u.bind.id = (uint64_t)map;
+	req->u.bind.id = (uintptr_t)map;
 	memcpy(req->u.bind.addr, addr, sizeof(*addr));
 	req->u.bind.len = addr_len;
 
@@ -725,7 +725,7 @@ int pvcalls_front_listen(struct socket *sock, int backlog)
 	req = RING_GET_REQUEST(&bedata->ring, req_id);
 	req->req_id = req_id;
 	req->cmd = PVCALLS_LISTEN;
-	req->u.listen.id = (uint64_t) map;
+	req->u.listen.id = (uintptr_t) map;
 	req->u.listen.backlog = backlog;
 
 	bedata->ring.req_prod_pvt++;
@@ -829,9 +829,9 @@ int pvcalls_front_accept(struct socket *sock, struct socket *newsock, int flags)
 	req = RING_GET_REQUEST(&bedata->ring, req_id);
 	req->req_id = req_id;
 	req->cmd = PVCALLS_ACCEPT;
-	req->u.accept.id = (uint64_t) map;
+	req->u.accept.id = (uintptr_t) map;
 	req->u.accept.ref = map2->active.ref;
-	req->u.accept.id_new = (uint64_t) map2;
+	req->u.accept.id_new = (uintptr_t) map2;
 	req->u.accept.evtchn = evtchn;
 	map->passive.accept_map = map2;
 
@@ -925,7 +925,7 @@ static unsigned int pvcalls_front_poll_passive(struct file *file,
 	req = RING_GET_REQUEST(&bedata->ring, req_id);
 	req->req_id = req_id;
 	req->cmd = PVCALLS_POLL;
-	req->u.poll.id = (uint64_t) map;
+	req->u.poll.id = (uintptr_t) map;
 
 	bedata->ring.req_prod_pvt++;
 	RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&bedata->ring, notify);
@@ -1023,7 +1023,7 @@ int pvcalls_front_release(struct socket *sock)
 	req = RING_GET_REQUEST(&bedata->ring, req_id);
 	req->req_id = req_id;
 	req->cmd = PVCALLS_RELEASE;
-	req->u.release.id = (uint64_t)map;
+	req->u.release.id = (uintptr_t)map;
 
 	bedata->ring.req_prod_pvt++;
 	RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&bedata->ring, notify);
-- 
1.9.1

      reply	other threads:[~2017-10-30 21:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-30 21:40 [PATCH 1/2] pvcalls: check return value from copy_from/to_iter Stefano Stabellini
2017-10-30 21:40 ` Stefano Stabellini [this message]

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=1509399611-12503-2-git-send-email-sstabellini@kernel.org \
    --to=sstabellini@kernel.org \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stefano@aporeto.com \
    --cc=xen-devel@lists.xen.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®