[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] xen/arm: ioremap_attr: return NULL is __vmap failed



commit f1b346fdb72c86367c28e79d140ccc8515a0c3f4
Author:     Julien Grall <julien.grall@xxxxxxxxxx>
AuthorDate: Mon Nov 18 13:08:23 2013 +0000
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Tue Nov 19 16:00:03 2013 +0000

    xen/arm: ioremap_attr: return NULL is __vmap failed
    
    Most of ioremap_* caller check if ioremap returns NULL. Actually, if the
    physical address is non-aligned, Xen will return the pointer given by
    __vmap plus the offset in the page. So if ioremap_* fails, the caller
    will retrieve an non-NULL address and continue as if there was no error.
    
    Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx>
    Acked-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 xen/arch/arm/mm.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 123280e..2de7dc7 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -742,8 +742,12 @@ void *ioremap_attr(paddr_t pa, size_t len, unsigned int 
attributes)
     unsigned long pfn = PFN_DOWN(pa);
     unsigned int offs = pa & (PAGE_SIZE - 1);
     unsigned int nr = PFN_UP(offs + len);
+    void *ptr = __vmap(&pfn, nr, 1, 1, attributes);
 
-    return (__vmap(&pfn, nr, 1, 1, attributes) + offs);
+    if ( ptr == NULL )
+        return NULL;
+
+    return ptr + offs;
 }
 
 void *ioremap(paddr_t pa, size_t len)
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.