lkml.org 
[lkml]   [2015]   [Aug]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] mm: mmap: Check all failures before set values
Date
On 8/24/15 19:32, Michal Hocko wrote:
> On Mon 24-08-15 00:59:39, gang.chen.5i5j@qq.com wrote:
>>> From: Chen Gang <gang.chen.5i5j@gmail.com>
>>>
>>> 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.
>

It can save several insns when failure occurs.

It is always a little better to let the external function suppose fewer
callers' behalf.

It can save the code readers' (especially new readers') time resource
to avoid to analyze why set 'vma->vm_pgoff' before checking '-ENOMEM'
(may it cause issue? or is 'vm_pgoff' related with the next checking?).


Thanks.
--
Chen Gang

Open, share, and attitude like air, water, and life which God blessed
\
 
 \ /
  Last update: 2015-08-24 15:41    [W:0.071 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site