lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1450741676-5865-39-git-send-email-viro@ZenIV.linux.org.uk>
Date:	Mon, 21 Dec 2015 23:47:12 +0000
From:	Al Viro <viro@...IV.linux.org.uk>
To:	linux-kernel@...r.kernel.org
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [POC][PATCH 39/83] gnttab_end_foreign_access(): switch the last argument to void *

From: Al Viro <viro@...iv.linux.org.uk>

Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
---
 drivers/block/xen-blkfront.c      | 12 ++++++------
 drivers/char/tpm/xen-tpmfront.c   |  2 +-
 drivers/input/misc/xen-kbdfront.c |  4 ++--
 drivers/net/xen-netfront.c        |  6 +++---
 drivers/pci/xen-pcifront.c        |  2 +-
 drivers/scsi/xen-scsifront.c      |  8 +++-----
 drivers/xen/grant-table.c         |  6 +++---
 include/xen/grant_table.h         |  3 +--
 8 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 19b8697..c5873c2 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -1094,7 +1094,7 @@ static void blkif_free(struct blkfront_info *info, int suspend)
 			list_del(&persistent_gnt->node);
 			if (persistent_gnt->gref != GRANT_INVALID_REF) {
 				gnttab_end_foreign_access(persistent_gnt->gref,
-				                          0, 0UL);
+				                          0, NULL);
 				info->persistent_gnts_c--;
 			}
 			if (info->feature_persistent)
@@ -1131,7 +1131,7 @@ static void blkif_free(struct blkfront_info *info, int suspend)
 		       info->shadow[i].req.u.rw.nr_segments;
 		for (j = 0; j < segs; j++) {
 			persistent_gnt = info->shadow[i].grants_used[j];
-			gnttab_end_foreign_access(persistent_gnt->gref, 0, 0UL);
+			gnttab_end_foreign_access(persistent_gnt->gref, 0, NULL);
 			if (info->feature_persistent)
 				__free_page(persistent_gnt->page);
 			kfree(persistent_gnt);
@@ -1146,7 +1146,7 @@ static void blkif_free(struct blkfront_info *info, int suspend)
 
 		for (j = 0; j < INDIRECT_GREFS(segs); j++) {
 			persistent_gnt = info->shadow[i].indirect_grants[j];
-			gnttab_end_foreign_access(persistent_gnt->gref, 0, 0UL);
+			gnttab_end_foreign_access(persistent_gnt->gref, 0, NULL);
 			__free_page(persistent_gnt->page);
 			kfree(persistent_gnt);
 		}
@@ -1170,7 +1170,7 @@ free_shadow:
 	/* Free resources associated with old device channel. */
 	for (i = 0; i < info->nr_ring_pages; i++) {
 		if (info->ring_ref[i] != GRANT_INVALID_REF) {
-			gnttab_end_foreign_access(info->ring_ref[i], 0, 0);
+			gnttab_end_foreign_access(info->ring_ref[i], 0, NULL);
 			info->ring_ref[i] = GRANT_INVALID_REF;
 		}
 	}
@@ -1261,7 +1261,7 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info,
 			 * so it will not be picked again unless we run out of
 			 * persistent grants.
 			 */
-			gnttab_end_foreign_access(s->grants_used[i]->gref, 0, 0UL);
+			gnttab_end_foreign_access(s->grants_used[i]->gref, 0, NULL);
 			s->grants_used[i]->gref = GRANT_INVALID_REF;
 			list_add_tail(&s->grants_used[i]->node, &info->grants);
 		}
@@ -1277,7 +1277,7 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info,
 			} else {
 				struct page *indirect_page;
 
-				gnttab_end_foreign_access(s->indirect_grants[i]->gref, 0, 0UL);
+				gnttab_end_foreign_access(s->indirect_grants[i]->gref, 0, NULL);
 				/*
 				 * Add the used indirect page back to the list of
 				 * available pages for indirect grefs.
diff --git a/drivers/char/tpm/xen-tpmfront.c b/drivers/char/tpm/xen-tpmfront.c
index 4ac4830..2ccd0c9 100644
--- a/drivers/char/tpm/xen-tpmfront.c
+++ b/drivers/char/tpm/xen-tpmfront.c
@@ -273,7 +273,7 @@ static void ring_free(struct tpm_private *priv)
 
 	if (priv->ring_ref)
 		gnttab_end_foreign_access(priv->ring_ref, 0,
-				(unsigned long)priv->shr);
+				priv->shr);
 	else
 		free_page(priv->shr);
 
diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
index d70a619..93f3a5c 100644
--- a/drivers/input/misc/xen-kbdfront.c
+++ b/drivers/input/misc/xen-kbdfront.c
@@ -291,7 +291,7 @@ static int xenkbd_connect_backend(struct xenbus_device *dev,
  error_evtchan:
 	xenbus_free_evtchn(dev, evtchn);
  error_grant:
-	gnttab_end_foreign_access(info->gref, 0, 0UL);
+	gnttab_end_foreign_access(info->gref, 0, NULL);
 	info->gref = -1;
 	return ret;
 }
@@ -302,7 +302,7 @@ static void xenkbd_disconnect_backend(struct xenkbd_info *info)
 		unbind_from_irqhandler(info->irq, info);
 	info->irq = -1;
 	if (info->gref >= 0)
-		gnttab_end_foreign_access(info->gref, 0, 0UL);
+		gnttab_end_foreign_access(info->gref, 0, NULL);
 	info->gref = -1;
 }
 
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 0f9b7cf..c36af78 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1117,7 +1117,7 @@ static void xennet_release_tx_bufs(struct netfront_queue *queue)
 		get_page(queue->grant_tx_page[i]);
 		gnttab_end_foreign_access(queue->grant_tx_ref[i],
 					  GNTMAP_readonly,
-					  (unsigned long)page_address(queue->grant_tx_page[i]));
+					  page_address(queue->grant_tx_page[i]));
 		queue->grant_tx_page[i] = NULL;
 		queue->grant_tx_ref[i] = GRANT_INVALID_REF;
 		add_id_to_freelist(&queue->tx_skb_freelist, queue->tx_skbs, i);
@@ -1150,7 +1150,7 @@ static void xennet_release_rx_bufs(struct netfront_queue *queue)
 		 */
 		get_page(page);
 		gnttab_end_foreign_access(ref, 0,
-					  (unsigned long)page_address(page));
+					  page_address(page));
 		queue->grant_rx_ref[id] = GRANT_INVALID_REF;
 
 		kfree_skb(skb);
@@ -1378,7 +1378,7 @@ static void xennet_end_access(int ref, void *page)
 {
 	/* This frees the page as a side-effect */
 	if (ref != GRANT_INVALID_REF)
-		gnttab_end_foreign_access(ref, 0, (unsigned long)page);
+		gnttab_end_foreign_access(ref, 0, page);
 }
 
 static void xennet_disconnect_backend(struct netfront_info *info)
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index 85f69e5..90b77b9 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -772,7 +772,7 @@ static void free_pdev(struct pcifront_device *pdev)
 
 	if (pdev->gnt_ref != INVALID_GRANT_REF)
 		gnttab_end_foreign_access(pdev->gnt_ref, 0 /* r/w page */,
-					  (unsigned long)pdev->sh_info);
+					  pdev->sh_info);
 	else
 		free_page(pdev->sh_info);
 
diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
index d59486a..825759b 100644
--- a/drivers/scsi/xen-scsifront.c
+++ b/drivers/scsi/xen-scsifront.c
@@ -215,7 +215,7 @@ static void scsifront_gnttab_done(struct vscsifrnt_info *info, uint32_t id)
 				     "grant still in use by backend\n");
 			BUG();
 		}
-		gnttab_end_foreign_access(s->gref[i], 0, 0UL);
+		gnttab_end_foreign_access(s->gref[i], 0, NULL);
 	}
 
 	kfree(s->sg);
@@ -763,8 +763,7 @@ static int scsifront_alloc_ring(struct vscsifrnt_info *info)
 free_irq:
 	unbind_from_irqhandler(info->irq, info);
 free_gnttab:
-	gnttab_end_foreign_access(info->ring_ref, 0,
-				  (unsigned long)info->ring.sring);
+	gnttab_end_foreign_access(info->ring_ref, 0, info->ring.sring);
 
 	return err;
 }
@@ -772,8 +771,7 @@ free_gnttab:
 static void scsifront_free_ring(struct vscsifrnt_info *info)
 {
 	unbind_from_irqhandler(info->irq, info);
-	gnttab_end_foreign_access(info->ring_ref, 0,
-				  (unsigned long)info->ring.sring);
+	gnttab_end_foreign_access(info->ring_ref, 0, info->ring.sring);
 }
 
 static int scsifront_init_ring(struct vscsifrnt_info *info)
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index 1189c13..29d88da 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -379,12 +379,12 @@ static void gnttab_add_deferred(grant_ref_t ref, bool readonly,
 }
 
 void gnttab_end_foreign_access(grant_ref_t ref, int readonly,
-			       unsigned long page)
+			       void *page)
 {
 	if (gnttab_end_foreign_access_ref(ref, readonly)) {
 		put_free_entry(ref);
-		if (page != 0)
-			free_page((void *)page);
+		if (page)
+			free_page(page);
 	} else
 		gnttab_add_deferred(ref, readonly,
 				    page ? virt_to_page(page) : NULL);
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
index 34b1379..e5bb11a 100644
--- a/include/xen/grant_table.h
+++ b/include/xen/grant_table.h
@@ -98,8 +98,7 @@ int gnttab_end_foreign_access_ref(grant_ref_t ref, int readonly);
  * immediately iff the grant entry is not in use, otherwise it will happen
  * some time later.  page may be 0, in which case no freeing will occur.
  */
-void gnttab_end_foreign_access(grant_ref_t ref, int readonly,
-			       unsigned long page);
+void gnttab_end_foreign_access(grant_ref_t ref, int readonly, void *page);
 
 int gnttab_grant_foreign_transfer(domid_t domid, unsigned long pfn);
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ