On Wed, Dec 19, 2018 at 05:28:25PM +0100, Sam Ravnborg wrote: > > + struct scatterlist *sg; > > + int j, n; > Nit - in the other use of for_each_sg() you used "i" as the variable named. > It confused me a little to see "j". I think this was a copy and paste from the one function where i was already taken. I can remove it here. > sg-lenght and sg->offsett are both unsigned int. > So n should looking at this piece of code be unsigned int. > But then iommu_get_one() takes an int as argument. > So the real issue seems to be that iommu_get_one() should > have npages be an unsigned int. And your code is fine. > > If you had named n for npages it would have been a little more readable. Well, n isn't really new here but from the existing code. I see plenty of potential for the usual cleanups in that code..