From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23A9AC352BE for ; Thu, 16 Apr 2020 20:08:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B8758221F9 for ; Thu, 16 Apr 2020 20:08:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B8758221F9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0CF278E00E0; Thu, 16 Apr 2020 16:08:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0A73C8E00BC; Thu, 16 Apr 2020 16:08:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F24BA8E00E0; Thu, 16 Apr 2020 16:08:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D70D68E00BC for ; Thu, 16 Apr 2020 16:08:09 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 9895C5DF2 for ; Thu, 16 Apr 2020 20:08:09 +0000 (UTC) X-FDA: 76714804698.02.wound31_645063f438700 X-HE-Tag: wound31_645063f438700 X-Filterd-Recvd-Size: 3274 Received: from smtprelay.hostedemail.com (smtprelay0175.hostedemail.com [216.40.44.175]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Thu, 16 Apr 2020 20:08:09 +0000 (UTC) Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id ECAD618224D93; Thu, 16 Apr 2020 20:08:08 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: alley89_6406c9b99173f X-Filterd-Recvd-Size: 2121 Received: from XPS-9350.home (unknown [47.151.136.130]) (Authenticated sender: joe@perches.com) by omf16.hostedemail.com (Postfix) with ESMTPA; Thu, 16 Apr 2020 20:08:07 +0000 (UTC) Message-ID: <4a40bfcf1c964bbb9b68a8b7c467a5a770907e4a.camel@perches.com> Subject: Re: [PATCH v4] mm/ksm: Fix NULL pointer dereference when KSM zero page is enabled From: Joe Perches To: Kirill Tkhai , Markus Elfring , Andrew Morton , Muchun Song , Xiongchun Duan Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, David Hildenbrand , Yang Shi Date: Thu, 16 Apr 2020 13:05:54 -0700 In-Reply-To: References: <20200416025034.29780-1-songmuchun@bytedance.com> <20200415195841.da4361916f662a0136a271a5@linux-foundation.org> <516df5d7-b514-11dc-130e-f1a2edce0108@web.de> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.1-2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, 2020-04-16 at 14:20 +0300, Kirill Tkhai wrote: > On 16.04.2020 09:14, Markus Elfring wrote: > > =E2=80=A6 > > > > +++ b/mm/ksm.c > > > > @@ -2112,8 +2112,15 @@ static void cmp_and_merge_page(struct page= *page, struct rmap_item *rmap_item) > > =E2=80=A6 > > > > + if (vma) > > > > + err =3D 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. trivia: It's generally better to not use "/**" as that's used for kernel-doc and this could be a single line like + /* If the vma is out of date, no need to continue */ > > > It's conventional to put braces around multi-line blocks such as th= is. true > > Are there different views to consider around the usage of single stat= ements > > together with curly brackets in if branches? no