diff options
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_provider.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c index 4cc7e2846df1..30b67c200267 100644 --- a/drivers/infiniband/hw/mthca/mthca_provider.c +++ b/drivers/infiniband/hw/mthca/mthca_provider.c | |||
@@ -783,24 +783,20 @@ static struct ib_mr *mthca_reg_phys_mr(struct ib_pd *pd, | |||
783 | if ((*iova_start & ~PAGE_MASK) != (buffer_list[0].addr & ~PAGE_MASK)) | 783 | if ((*iova_start & ~PAGE_MASK) != (buffer_list[0].addr & ~PAGE_MASK)) |
784 | return ERR_PTR(-EINVAL); | 784 | return ERR_PTR(-EINVAL); |
785 | 785 | ||
786 | if (num_phys_buf > 1 && | ||
787 | ((buffer_list[0].addr + buffer_list[0].size) & ~PAGE_MASK)) | ||
788 | return ERR_PTR(-EINVAL); | ||
789 | |||
790 | mask = 0; | 786 | mask = 0; |
791 | total_size = 0; | 787 | total_size = 0; |
792 | for (i = 0; i < num_phys_buf; ++i) { | 788 | for (i = 0; i < num_phys_buf; ++i) { |
793 | if (i != 0 && buffer_list[i].addr & ~PAGE_MASK) | 789 | if (i != 0) |
794 | return ERR_PTR(-EINVAL); | 790 | mask |= buffer_list[i].addr; |
795 | if (i != 0 && i != num_phys_buf - 1 && | 791 | if (i != num_phys_buf - 1) |
796 | (buffer_list[i].size & ~PAGE_MASK)) | 792 | mask |= buffer_list[i].addr + buffer_list[i].size; |
797 | return ERR_PTR(-EINVAL); | ||
798 | 793 | ||
799 | total_size += buffer_list[i].size; | 794 | total_size += buffer_list[i].size; |
800 | if (i > 0) | ||
801 | mask |= buffer_list[i].addr; | ||
802 | } | 795 | } |
803 | 796 | ||
797 | if (mask & ~PAGE_MASK) | ||
798 | return ERR_PTR(-EINVAL); | ||
799 | |||
804 | /* Find largest page shift we can use to cover buffers */ | 800 | /* Find largest page shift we can use to cover buffers */ |
805 | for (shift = PAGE_SHIFT; shift < 31; ++shift) | 801 | for (shift = PAGE_SHIFT; shift < 31; ++shift) |
806 | if (num_phys_buf > 1) { | 802 | if (num_phys_buf > 1) { |