Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp3574556ioa; Tue, 26 Apr 2022 06:22:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfSyvIT+cTtiuEH6Tdbs11eems/jU+e9m/AHKy//HLTGD4sjKLn3jGskUq8mJe0rGDTeqF X-Received: by 2002:a17:902:d2c5:b0:15d:4128:21d5 with SMTP id n5-20020a170902d2c500b0015d412821d5mr1426001plc.165.1650979367562; Tue, 26 Apr 2022 06:22:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650979367; cv=none; d=google.com; s=arc-20160816; b=dP46KiRGYno2ioYqgbXVdVGDg6Co1gR7FBZn80J55PyiQj2EmJ7ic8zaacj3ahljZi Dh8fN4zb54ALNXIHTC3QYonBwG3d9pu20zuLZK6KWVnv6srzs8v+MuwIHiSWnR1oSHSK Mir081DVn4FDxre1gFKgZQ/qaJht25Yu62P8fHnn82+Hlny+LRV3NgaEL5cJUvqtxeIw GdejC5LmamgZcOkryIDAisKA44QAu3QBDNa40eUBLKbkQTdttUFICS3HOgS5wuUmvdaZ k7Np4GIpNIQDQjjnGiGC5kXfzCxD7ecQrOHqZFoF27FdAMtSPR1gPJlmolypPKUq8kc2 +kXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=oFju6382BGkZeSCzVjUNRKIZ/1PRe5wDyUSMoe2X2bs=; b=HL8QWjVKMU5t057c6KrV8Vsoiy2UE+U8MtSh5ntzHO8JgPQZB2EP82gm0pp2u+Y1se SChsnW+kL4KynjnD4s9eelC5p5g/ybE478YzuzOEgjNZcn4gfLhbHATDv52+1k0v4ZrB T99oMPF3bAzO92tuV9Wv7NEslnmJXgKdhHH682rxkh844lioBxiw0tv2Mkv0kDXNR5rf ld3kMyQDzmDW+XJT0zdCaDh/KzSIZGClPMHrhk0wSn/0YrrW9qfB99n/W/iiIgHeHtB7 m/7zTvzd3AL1qDvDnatdJP8vfw4dAamw9AuEqpogCCPFOtUHnsXv1IGaM0jPYSZSAmWR r3UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="cixsBX/R"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q8-20020a056a00150800b004fa3a8e0053si65923pfu.266.2022.04.26.06.22.30; Tue, 26 Apr 2022 06:22:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="cixsBX/R"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349764AbiDZML2 (ORCPT + 99 others); Tue, 26 Apr 2022 08:11:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345487AbiDZML0 (ORCPT ); Tue, 26 Apr 2022 08:11:26 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D42915044E for ; Tue, 26 Apr 2022 05:08:18 -0700 (PDT) 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=oFju6382BGkZeSCzVjUNRKIZ/1PRe5wDyUSMoe2X2bs=; b=cixsBX/RRpllrTZFRx1hr8Maiv jF26zQymv/PfTCKgTN5mjT82DB8Ld0x3Yp2anTkssEu/bJMNsbpNaQ56kzjKX/dzVoVFowtIvisZm fl5rRr73u46yD7NTvbo/sdJN0pLkGxLdFEFLadtsmrA7b+glmX2Ryh3WM/QzPIeX/6uLV4KF8jsDS LwckdvOcKbqxohtL7SQkd81G91wQhHczN/eEpfCgaYl7K9qQvzt8+j/gXVtSlwDddErTa/DScdztB Dak/2i/zPGSKpjCVgKjE/qjhaZ2YCJuA/CE5Ygdxwa41o4UjMyIYOqT6O3b9aXQw0o6M4NrMqKuYS nvZSyAUw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1njJzE-009c41-AM; Tue, 26 Apr 2022 12:08:08 +0000 Date: Tue, 26 Apr 2022 13:08:08 +0100 From: Matthew Wilcox To: Wan Jiabing Cc: Andrew Morton , Vlastimil Babka , David Howells , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Julia Lawall Subject: Re: [PATCH] mm/filemap: Fix NULL pointer dereference in pagecache_get_page Message-ID: References: <20220426082549.590899-1-wanjiabing@vivo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220426082549.590899-1-wanjiabing@vivo.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 26, 2022 at 04:25:48PM +0800, Wan Jiabing wrote: > Fix following coccicheck error: > mm/folio-compat.c:128:17-21: ERROR: folio is NULL but dereferenced. > folio = __filemap_get_folio(mapping, index, fgp_flags, gfp); > - if ((fgp_flags & FGP_HEAD) || !folio || xa_is_value(folio)) > + if (!folio) > + return NULL; > + if ((fgp_flags & FGP_HEAD) || xa_is_value(folio)) > return &folio->page; That doesn't dereference the folio. Coccicheck is wrong.