On Wed, Oct 9, 2019 at 8:14 AM Kirill A. Shutemov <kirill@xxxxxxxxxxxxx> wrote: > > If ->pte_entry() fails on the first entry of the page table, pte - 1 will > point out side the page table. > > And the '- 1' is totally unnecessary as we break the loop before pte++ on > the last iteration. Good catch. Too much copying the wrong pattern from other sources. I do wish we didn't have this pattern of "update pte, then do pte_unmap as long as it's in the same page". Yeah, it avoids a variable, but still... But it is what it is, and we just need to be careful. Linus