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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57E9DC4332F for ; Wed, 19 Oct 2022 13:13:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B96366B0071; Wed, 19 Oct 2022 09:13:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B462A6B0073; Wed, 19 Oct 2022 09:13:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A5C876B0074; Wed, 19 Oct 2022 09:13:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 97A476B0071 for ; Wed, 19 Oct 2022 09:13:27 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 72EAAA0590 for ; Wed, 19 Oct 2022 13:13:27 +0000 (UTC) X-FDA: 80037740454.08.B172F28 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf03.hostedemail.com (Postfix) with ESMTP id EE2F12002A for ; Wed, 19 Oct 2022 13:13:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=XYcog8ocgROVcCPLoEEuCjc+/RbhDrn1MjAOaQsxUMQ=; b=Gx0C3ws/uzyETcYVQsF1zDuOVD LzolMU87iYcl9ByTKX/LtTd51rC/4W6tTJ5EAq7zlYOvFxRcBrR0RgGTiVH8tYV6mGPWBBgQLY1Rw AkDmfFKZNadjEpPKWbX00RapQQHUp3BIV82OJYvnzEpPvLdHyf6OZsRZhwIisT7DO1xOF3z+PYtHW o3+HyT90gdo7m1P8iuwOJ+Otfl2lffLG87WMlAuKWMKMCw9zvkQkD/yPMkPa5di8bRRy2PvCOae0+ Q//DQ2BZs0AqybtkjtkhGiLLBC0GkaWJgw5/qeu/Yyulr43XFeydnqF+02t8mSI2f8GFHJNiiVd/j UCDcnlWw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1ol8st-00BZHZ-Oi; Wed, 19 Oct 2022 13:13:23 +0000 Date: Wed, 19 Oct 2022 14:13:23 +0100 From: Matthew Wilcox To: Andrew Morton Cc: Tuo Cao <91tuocao@gmail.com>, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: folio-compat: fix bug for pagecache_get_page Message-ID: References: <20221018143639.5099-1-91tuocao@gmail.com> <20221018134834.97e685f9a9445c4553ce158b@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221018134834.97e685f9a9445c4553ce158b@linux-foundation.org> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666185206; a=rsa-sha256; cv=none; b=UzegP5qpExfTw8nQidjlii+OVt3CayLGtS9L2edYFkZ6DZ0GqUQy2Xep1ch3tcIhr0bpCl m2U9PQpcHFbL7fiWcEH8l2RuwD7yoVdC+d8hBWEjIYPQCwsF47+QrEJpyIW11+ut4E61aw VgPSz2ENPGsh8mcbVDFnNmZCb8z6guE= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="Gx0C3ws/"; spf=none (imf03.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666185206; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=XYcog8ocgROVcCPLoEEuCjc+/RbhDrn1MjAOaQsxUMQ=; b=f9Cfry7r/3xoIhRzF8t7pMZcnWVoeVN87DdMgJ6iTSDCT13W7ho8Bwm+S3S4ghbjVK/kCJ eKzo45KYXGkVcXdeS+zHdMiTTuEUDv4OTjCk9MBV/RK6xE+gOMSQYr/JfnXuUFEn5oe5Dz TOpiFOF0PH3BTg7vigWIUfa17j/3NbY= X-Stat-Signature: zsswd4633c7acd5ushw83cdnjdrksgae X-Rspamd-Queue-Id: EE2F12002A X-Rspam-User: X-Rspamd-Server: rspam03 Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="Gx0C3ws/"; spf=none (imf03.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-HE-Tag: 1666185205-124291 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 Tue, Oct 18, 2022 at 01:48:34PM -0700, Andrew Morton wrote: > On Tue, 18 Oct 2022 15:39:39 +0100 Matthew Wilcox wrote: > > > On Tue, Oct 18, 2022 at 10:36:39PM +0800, Tuo Cao wrote: > > > The folio returned from __filemap_get_folio may be a NULL, it will > > > causes the kernel crash when access folio->page. > > > > This is not a bug. &folio->page does not dereference folio but performs > > pointer arithmetic. > > This is the third attempt to "fix" this. So far. I think we should > take the hint and make the check for a null pointer more explicit. I think it's doing a great job of pointing out how many alleged kernel programmers don't actually understand C and aren't capable of searching mailing lists to see if somebody else already sent a patch. Hopefully somebody's keeping track and is feeding this information into their hiring algorithms. The real solution is to convert all the callers of pagecache_get_page() to use folios, and then we can delete this code. I have a small series in progress. The amount of text savings is immense; half a kilobyte from one conversion alone. Our compound_head() has got very bloated.