From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [patch 2/2] fs, proc: Introduce the /proc//map_files/ directory v6 Date: Wed, 7 Sep 2011 15:53:32 -0700 Message-ID: <20110907155332.beda7d3d.akpm@linux-foundation.org> References: <20110905192009.GJ761@sun> <20110905194908.GA2690@albatros> <20110905203627.GL761@sun> <20110906101518.GA4799@albatros> <20110906165144.GJ18425@mtj.dyndns.org> <20110906172952.GA28055@albatros> <20110906173341.GM18425@mtj.dyndns.org> <20110907112301.GA12157@albatros> <20110907215329.GB28162@sun> <20110907151323.613e62e7.akpm@linux-foundation.org> <20110907224234.GD28162@sun> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kernel-hardening-ZwoEplunGu1jrUoiu81ncdBPR1lH4CV8@public.gmane.org, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Pavel Emelyanov , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, James Bottomley , containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org, Nathan Lynch , Alexey Dobriyan , Tejun Heo , Daniel Lezcano , Vasiliy Kulikov , Al Viro To: Cyrill Gorcunov Return-path: In-Reply-To: <20110907224234.GD28162@sun> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org List-Id: linux-fsdevel.vger.kernel.org On Thu, 8 Sep 2011 02:42:34 +0400 Cyrill Gorcunov wrote: > > > +err: > > > + up_read(&mm->mmap_sem); > > > + > > > + for (i = 0; i < used && !ret; i++) { > > > > The "&& !ret" is unneeded? > > No, it's needed, since it makes sure that if "impossible" > scenario happens and flex-arrays fails with preallocated > data so we will reach this point with used > 0 and ret = -ENOMEM > and thus will not call for proc_map_files_instantiate as needed. Well, it doesn't need to be tested on each pass around the loop - that's misleading and inefficient (unless the compiler is being particularly clever).