Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754290AbbHXV6H (ORCPT ); Mon, 24 Aug 2015 17:58:07 -0400 Received: from col004-omc1s15.hotmail.com ([65.55.34.25]:53750 "EHLO COL004-OMC1S15.hotmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753970AbbHXV6G (ORCPT ); Mon, 24 Aug 2015 17:58:06 -0400 X-TMN: [QPmiwEpBE/ArIQBg4zW5YSP8p7G5/b7j] X-Originating-Email: [xili_gchen_5257@hotmail.com] Message-ID: From: Chen Gang To: Andrew Morton , Michal Hocko CC: "kirill.shutemov@linux.intel.com" , "riel@redhat.com" , "sasha.levin@oracle.com" , "gang.chen.5i5j@gmail.com" , Linux Memory , kernel mailing list Subject: Re: [PATCH] mm: mmap: Check all failures before set values Date: Tue, 25 Aug 2015 05:58:05 +0800 Importance: Normal In-Reply-To: <55DB93B2.9010705@hotmail.com> References: <1440349179-18304-1-git-send-email-gang.chen.5i5j@qq.com> <20150824113212.GL17078@dhcp22.suse.cz> <20150824142555.76d9cf840dcbf8bbd9489b8c@linux-foundation.org>,<55DB93B2.9010705@hotmail.com> Content-Type: text/plain; charset="gb2312" MIME-Version: 1.0 X-OriginalArrivalTime: 24 Aug 2015 21:58:05.0519 (UTC) FILETIME=[F47145F0:01D0DEB7] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id t7OLwDs5014025 Content-Length: 897 Lines: 26 On 8/25/15 05:25, Andrew Morton wrote: > On Mon, 24 Aug 2015 13:32:13 +0200 Michal Hocko wrote: > >> On Mon 24-08-15 00:59:39, gang.chen.5i5j@qq.com wrote: >>> From: Chen Gang >>> >>> 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 ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?