Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1506674ybz; Thu, 16 Apr 2020 10:20:32 -0700 (PDT) X-Google-Smtp-Source: APiQypLkfIphJIlO3tP6h6mV0gwHhgb2JvwO1m9JzaiBCa/GdZ737nscN0MisR4HcUolBZ+Az/fH X-Received: by 2002:a17:906:1641:: with SMTP id n1mr10814517ejd.365.1587057632748; Thu, 16 Apr 2020 10:20:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587057632; cv=none; d=google.com; s=arc-20160816; b=vqDaNGnPzRV0GS295jIUnwR1JeRcoRRLO9B+NTLNLW/7At8tgaNkn2kOtFz6/GCVGV Sv8jUYBm6WsllSk+BVJ50Mx69p5RZPamCPH4xFrmg1kCzAMDiP7LrdVihuJzATo86F/3 /B4DwwZaYnFW5omrlgD0d0H3EcM/07l9pejQgus61/nJigVlpmMMRuFPTMoSLNUdU8Tn igULfoqUgPPhCEJyk158H4SFaE9Lmm+CqcDmdOCYf6dS4620sjNqbtHOKDmq7FqF+Gc1 DCiQLkp7nOnhQmMrKMtNd02CdifPZFm7wivrirBnMS+35gTplMsZIF+Iv8yYJQPJ4RTp cfLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=+n1A89UQ1xEtlYxm3DGxHQE13eQt05kV0RBdgkn8a5k=; b=Cpv6V3pz4KuAHidgepLwg3vBHVJUYQnBtWxDx6UkTvuId2yO8gpRO9ahyVriTIqnrp dl+S/ejn3ZGvAI6BfQK2l36g+s9Ma8RX+MaSUNUS/RmS03Ha4wzniAjCgy8FvzTh5EF+ Ki/Xb+vK/81KyTwf7oh9/COWmgyVNsWxvx9Uz4znTY6cYQ7KW8yvboFtgdcOeDo7JFK6 GwNxmnn6acXpPupUPodJRoyXMkUUnFZo/z/ifKWRVmnaYWWs5O4efPKJfmC2B58rpqXL K8y7csZ8Cl15JtGrQEFMwnLP25Mww5XCLRHt7zbFPyacGBw7ev7XlC/9u39mvXgjs0EA Ap/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p7si12713281ejz.412.2020.04.16.10.20.08; Thu, 16 Apr 2020 10:20:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2632894AbgDPLYV (ORCPT + 99 others); Thu, 16 Apr 2020 07:24:21 -0400 Received: from relay.sw.ru ([185.231.240.75]:39622 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2633001AbgDPLU4 (ORCPT ); Thu, 16 Apr 2020 07:20:56 -0400 Received: from [192.168.15.163] by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1jP2ZF-0003vx-HH; Thu, 16 Apr 2020 14:20:25 +0300 Subject: Re: [PATCH v4] mm/ksm: Fix NULL pointer dereference when KSM zero page is enabled To: Markus Elfring , Andrew Morton , Muchun Song , Xiongchun Duan Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, David Hildenbrand , Yang Shi References: <20200416025034.29780-1-songmuchun@bytedance.com> <20200415195841.da4361916f662a0136a271a5@linux-foundation.org> <516df5d7-b514-11dc-130e-f1a2edce0108@web.de> From: Kirill Tkhai Message-ID: Date: Thu, 16 Apr 2020 14:20:24 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <516df5d7-b514-11dc-130e-f1a2edce0108@web.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16.04.2020 09:14, Markus Elfring wrote: > … >>> +++ b/mm/ksm.c >>> @@ -2112,8 +2112,15 @@ static void cmp_and_merge_page(struct page *page, struct rmap_item *rmap_item) > … >>> + if (vma) >>> + err = try_to_merge_one_page(vma, page, >>> + ZERO_PAGE(rmap_item->address)); >>> + else >>> + /** >>> + * If the vma is out of date, we do not need to >>> + * continue. >>> + */ >>> + err = 0; >>> up_read(&mm->mmap_sem); > … >> It's conventional to put braces around multi-line blocks such as this. > > Are there different views to consider around the usage of single statements > together with curly brackets in if branches? For me Andrew's conversion is the best readable. I try to comment the code the same way myself. I even thought it's kernel default style :) Kirill