ioremap: Delay sanity check until after a successful mapping
While tracking down the reason for an ioremap() failure I was distracted by the WARN_ONCE() in __ioremap_caller(). Performing a WARN_ONCE() sanity check before the mapping is successful seems pointless if the caller sends bad values. A case in point is when the BIOS provides erroneous screen_info values causing vesafb_probe() to request an outrageuous size. The WARN_ONCE is then wasted on bogosity. Move the warning to a point where the mapping has been successfully allocated. Addresses: http://bugs.launchpad.net/bugs/772042 Reviewed-by: Suresh Siddha <suresh.b.siddha@intel.com> Signed-off-by: Tim Gardner <tim.gardner@canonical.com> Link: http://lkml.kernel.org/r/4DB99D2E.9080106@canonical.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
@@ -90,13 +90,6 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
|
|||||||
if (is_ISA_range(phys_addr, last_addr))
|
if (is_ISA_range(phys_addr, last_addr))
|
||||||
return (__force void __iomem *)phys_to_virt(phys_addr);
|
return (__force void __iomem *)phys_to_virt(phys_addr);
|
||||||
|
|
||||||
/*
|
|
||||||
* Check if the request spans more than any BAR in the iomem resource
|
|
||||||
* tree.
|
|
||||||
*/
|
|
||||||
WARN_ONCE(iomem_map_sanity_check(phys_addr, size),
|
|
||||||
KERN_INFO "Info: mapping multiple BARs. Your kernel is fine.");
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Don't allow anybody to remap normal RAM that we're using..
|
* Don't allow anybody to remap normal RAM that we're using..
|
||||||
*/
|
*/
|
||||||
@@ -170,6 +163,13 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
|
|||||||
ret_addr = (void __iomem *) (vaddr + offset);
|
ret_addr = (void __iomem *) (vaddr + offset);
|
||||||
mmiotrace_ioremap(unaligned_phys_addr, unaligned_size, ret_addr);
|
mmiotrace_ioremap(unaligned_phys_addr, unaligned_size, ret_addr);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if the request spans more than any BAR in the iomem resource
|
||||||
|
* tree.
|
||||||
|
*/
|
||||||
|
WARN_ONCE(iomem_map_sanity_check(unaligned_phys_addr, unaligned_size),
|
||||||
|
KERN_INFO "Info: mapping multiple BARs. Your kernel is fine.");
|
||||||
|
|
||||||
return ret_addr;
|
return ret_addr;
|
||||||
err_free_area:
|
err_free_area:
|
||||||
free_vm_area(area);
|
free_vm_area(area);
|
||||||
|
Reference in New Issue
Block a user