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-32-git-send-email-viro@ZenIV.linux.org.uk>
Date:	Mon, 21 Dec 2015 23:47:05 +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 32/83] lguest: get rid of pointless casts

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

Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
---
 drivers/lguest/lg.h          | 2 +-
 drivers/lguest/lguest_user.c | 8 ++++----
 drivers/lguest/page_tables.c | 8 ++++----
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h
index ac8ad04..3334ca0 100644
--- a/drivers/lguest/lg.h
+++ b/drivers/lguest/lg.h
@@ -56,7 +56,7 @@ struct lg_cpu {
 	unsigned long *reg_read; /* register from LHREQ_GETREG */
 
 	/* At end of a page shared mapped over lguest_pages in guest. */
-	unsigned long regs_page;
+	void *regs_page;
 	struct lguest_regs *regs;
 
 	struct lguest_pages *last_pages;
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index fe2e859..dac142b 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -170,12 +170,12 @@ static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip)
 	 * We need a complete page for the Guest registers: they are accessible
 	 * to the Guest and we can only grant it access to whole pages.
 	 */
-	cpu->regs_page = (unsigned long)get_zeroed_page(GFP_KERNEL);
+	cpu->regs_page = get_zeroed_page(GFP_KERNEL);
 	if (!cpu->regs_page)
 		return -ENOMEM;
 
 	/* We actually put the registers at the end of the page. */
-	cpu->regs = (void *)cpu->regs_page + PAGE_SIZE - sizeof(*cpu->regs);
+	cpu->regs = cpu->regs_page + PAGE_SIZE - sizeof(*cpu->regs);
 
 	/*
 	 * Now we initialize the Guest's registers, handing it the start
@@ -275,7 +275,7 @@ static int initialize(struct file *file, const unsigned long __user *input)
 
 free_regs:
 	/* FIXME: This should be in free_vcpu */
-	free_page((void *)lg->cpus[0].regs_page);
+	free_page(lg->cpus[0].regs_page);
 free_lg:
 	kfree(lg);
 unlock:
@@ -377,7 +377,7 @@ static int close(struct inode *inode, struct file *file)
 		/* Cancels the hrtimer set via LHCALL_SET_CLOCKEVENT. */
 		hrtimer_cancel(&lg->cpus[i].hrt);
 		/* We can free up the register page we allocated. */
-		free_page((void *)lg->cpus[i].regs_page);
+		free_page(lg->cpus[i].regs_page);
 		/*
 		 * Now all the memory cleanups are done, it's safe to release
 		 * the Launcher's memory management structure.
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c
index de1c8ac..f476c93 100644
--- a/drivers/lguest/page_tables.c
+++ b/drivers/lguest/page_tables.c
@@ -313,13 +313,13 @@ static pte_t *find_spte(struct lg_cpu *cpu, unsigned long vaddr, bool allocate,
 	spgd = spgd_addr(cpu, cpu->cpu_pgd, vaddr);
 	if (!(pgd_flags(*spgd) & _PAGE_PRESENT)) {
 		/* No shadow entry: allocate a new shadow PTE page. */
-		unsigned long ptepage;
+		pte_t *ptepage;
 
 		/* If they didn't want us to allocate anything, stop. */
 		if (!allocate)
 			return NULL;
 
-		ptepage = (unsigned long)get_zeroed_page(GFP_KERNEL);
+		ptepage = get_zeroed_page(GFP_KERNEL);
 		/*
 		 * This is not really the Guest's fault, but killing it is
 		 * simple for this corner case.
@@ -345,13 +345,13 @@ static pte_t *find_spte(struct lg_cpu *cpu, unsigned long vaddr, bool allocate,
 
 	if (!(pmd_flags(*spmd) & _PAGE_PRESENT)) {
 		/* No shadow entry: allocate a new shadow PTE page. */
-		unsigned long ptepage;
+		pte_t *ptepage;
 
 		/* If they didn't want us to allocate anything, stop. */
 		if (!allocate)
 			return NULL;
 
-		ptepage = (unsigned long)get_zeroed_page(GFP_KERNEL);
+		ptepage = get_zeroed_page(GFP_KERNEL);
 
 		/*
 		 * This is not really the Guest's fault, but killing it is
-- 
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