A question on vma_address()

Thibaut SAUTEREAU thibaut at sautereau.fr
Mon Oct 16 23:54:48 EDT 2017


Hi Perr,

On Mon, Oct 16, 2017 at 11:54:47PM +0800, Perr Zhang wrote:
> Why  should we use the function max() on 'start' and 'vma->vm_start'?
> Could the 'start' be less than 'vma->vm_start'?  If it is so, isn't it
> wrong to just return vma->vm_start but report an error?

The vma_address() function was recently changed in commit a8fa41ad2f6f7.
In the previous version, having the return value of __vma_address()
lower than vma->vm_start was actually triggering a VM_BUG_ON_VMA.

Taking a look at this commit and understanding why such changes had to
be done might help you find an answer to your question :)

-- 
Thibaut SAUTEREAU



More information about the Kernelnewbies mailing list