From 71ce41cf611b81f34bf5aa8534eb72e3b08493cb Mon Sep 17 00:00:00 2001 From: qubesuser Date: Sat, 10 Oct 2015 11:17:12 +0200 Subject: [PATCH] Fix u2mfn.ko for > 16TB RAM by not truncating to 32-bit improperly At the moment, Xen has a 16TB limit on x86, so this has no practical impact, aside for silencing compiler truncation warnings. Also, the rest of the GUI/u2mfn code and protocol would need to be expanded to use 64-bit mfns for Qubes to actually work there. --- kernel-modules/u2mfn/u2mfn.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel-modules/u2mfn/u2mfn.c b/kernel-modules/u2mfn/u2mfn.c index 2d48030..bcda468 100644 --- a/kernel-modules/u2mfn/u2mfn.c +++ b/kernel-modules/u2mfn/u2mfn.c @@ -50,8 +50,7 @@ static inline unsigned long virt_to_phys(volatile void *address) extern unsigned long *phys_to_machine_mapping; static inline unsigned long VIRT_TO_MFN(void *addr) { - unsigned int pfn = virt_to_phys(addr) >> PAGE_SHIFT; - return phys_to_machine_mapping[pfn] & ~FOREIGN_FRAME_BIT; + return phys_to_machine_mapping[virt_to_phys(addr) >> PAGE_SHIFT] & ~FOREIGN_FRAME_BIT; } #endif @@ -66,7 +65,7 @@ static long u2mfn_ioctl(struct file *f, unsigned int cmd, { struct page *user_page; void *kaddr; - int ret; + long ret; if (_IOC_TYPE(cmd) != U2MFN_MAGIC) { printk("Qubes u2mfn: wrong IOCTL magic");