[POC][PATCH 32/83] lguest: get rid of pointless casts

From: Al Viro
Date: Mon Dec 21 2015 - 19:05:49 EST


From: Al Viro <viro@xxxxxxxxxxxxxxxxxx>

Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
---
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/