On Tue, Feb 21, 2017 at 03:31:26PM +0200, Oleksandr Tyshchenko wrote: > On Tue, Feb 21, 2017 at 2:00 PM, Robin Murphy <robin.mur...@arm.com> wrote: > > Would it not be more logical (and simpler) to just check that the thing > > we dereference is valid to dereference when we dereference it? i.e.: > > > > -----8<----- > > diff --git a/drivers/iommu/io-pgtable-arm-v7s.c > > b/drivers/iommu/io-pgtable-arm-v7s.c > > index 0769276c0537..f3112f9ff494 100644 > > --- a/drivers/iommu/io-pgtable-arm-v7s.c > > +++ b/drivers/iommu/io-pgtable-arm-v7s.c > > @@ -418,8 +418,10 @@ static int __arm_v7s_map(struct arm_v7s_io_pgtable > > *data, unsigned long iova, > > pte |= ARM_V7S_ATTR_NS_TABLE; > > > > __arm_v7s_set_pte(ptep, pte, 1, cfg); > > - } else { > > + } else if (ARM_V7S_PTE_IS_TABLE(pte, lvl)) { > > cptep = iopte_deref(pte, lvl); > > + } else { > > + return -EEXIST; > > } > > > > /* Rinse, repeat */ > > ----->8----- > > Agree. Sounds reasonable. > > > > > I think the equivalent could be done in LPAE as well. > > OK. > > I will resend both modified patches without RFC prefix, right?
Sounds good to me. Will _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu