Re: [PATCH] mm: mmap: Check all failures before set values

From: Chen Gang
Date: Mon Aug 24 2015 - 17:58:11 EST


On 8/25/15 05:25, Andrew Morton wrote:
> On Mon, 24 Aug 2015 13:32:13 +0200 Michal Hocko <mhocko@xxxxxxxxxx> wrote:
>
>> On Mon 24-08-15 00:59:39, gang.chen.5i5j@xxxxxx wrote:
>>> From: Chen Gang <gang.chen.5i5j@xxxxxxxxx>
>>>
>>> When failure occurs and return, vma->vm_pgoff is already set, which is
>>> not a good idea.
>>
>> Why? The vma is not inserted anywhere and the failure path is supposed
>> to simply free the vma.
>
> Yes, it's pretty marginal but I suppose the code is a bit better with
> the patch than without. I did this:
>

OK, thanks. The comments really need to be improved, just like Michal
Hocko said before.


Thanks.
--
Chen Gang

Open, share, and attitude like air, water, and life which God blessed