diff options
Diffstat (limited to 'arch/x86/mm/pat.c')
-rw-r--r-- | arch/x86/mm/pat.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index a6cace0694a2..d2a72abc9de1 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c | |||
@@ -631,20 +631,21 @@ static unsigned long lookup_memtype(u64 paddr) | |||
631 | int io_reserve_memtype(resource_size_t start, resource_size_t end, | 631 | int io_reserve_memtype(resource_size_t start, resource_size_t end, |
632 | unsigned long *type) | 632 | unsigned long *type) |
633 | { | 633 | { |
634 | resource_size_t size = end - start; | ||
634 | unsigned long req_type = *type; | 635 | unsigned long req_type = *type; |
635 | unsigned long new_type; | 636 | unsigned long new_type; |
636 | int ret; | 637 | int ret; |
637 | 638 | ||
638 | WARN_ON_ONCE(iomem_map_sanity_check(start, end - start)); | 639 | WARN_ON_ONCE(iomem_map_sanity_check(start, size)); |
639 | 640 | ||
640 | ret = reserve_memtype(start, end, req_type, &new_type); | 641 | ret = reserve_memtype(start, end, req_type, &new_type); |
641 | if (ret) | 642 | if (ret) |
642 | goto out_err; | 643 | goto out_err; |
643 | 644 | ||
644 | if (!is_new_memtype_allowed(req_type, new_type)) | 645 | if (!is_new_memtype_allowed(start, size, req_type, new_type)) |
645 | goto out_free; | 646 | goto out_free; |
646 | 647 | ||
647 | if (kernel_map_sync_memtype(start, end - start, new_type) < 0) | 648 | if (kernel_map_sync_memtype(start, size, new_type) < 0) |
648 | goto out_free; | 649 | goto out_free; |
649 | 650 | ||
650 | *type = new_type; | 651 | *type = new_type; |
@@ -812,7 +813,8 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot, | |||
812 | return ret; | 813 | return ret; |
813 | 814 | ||
814 | if (flags != want_flags) { | 815 | if (flags != want_flags) { |
815 | if (strict_prot || !is_new_memtype_allowed(want_flags, flags)) { | 816 | if (strict_prot || |
817 | !is_new_memtype_allowed(paddr, size, want_flags, flags)) { | ||
816 | free_memtype(paddr, paddr + size); | 818 | free_memtype(paddr, paddr + size); |
817 | printk(KERN_ERR "%s:%d map pfn expected mapping type %s" | 819 | printk(KERN_ERR "%s:%d map pfn expected mapping type %s" |
818 | " for %Lx-%Lx, got %s\n", | 820 | " for %Lx-%Lx, got %s\n", |