Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6116203pxv; Thu, 29 Jul 2021 06:57:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6ZVCTf/qfghPJfBpkmRm5ZT08rKQWYBKexSp1l01EVDUZZFvGlttxVxDL2JEosroQicVa X-Received: by 2002:a05:6402:d67:: with SMTP id ec39mr6132094edb.117.1627567074162; Thu, 29 Jul 2021 06:57:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627567074; cv=none; d=google.com; s=arc-20160816; b=fJRYEF+GY8xnOV+pAxBECMac4YgzLVCxs0NicYtToRTIc0ZY/paTA9QkxTgZayZZYt eIea40Z94cshE/dAljH5Gmz8HiVR/N+dTaf9fCDMbscj2v1xthVrTwE1h8kXfqr3dhHB MTqrt6fpmxDIQ3FWHgG7j7lJA4dt2KnFZ5RCuR0I8efUSnhBAdsqb2UJ3E4NegqHi1EP UlMM7kakcRQhP/AzyuNevC5anhNvdRlsl6dGYIvWtdFlIwmFSEEs6poxB4L6saRaocAP FldYUk0mUmiC3/vCPjPw95tMiiR2+bmQnKpm5a6VM38qufY/+U7VoaTLrpcwv/tRZXtv dmWw== 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=//JteJBlPO/oxjTtV3LASZaFA4G6WCHzkWs4cs97Saw=; b=B+Uof21hFyUv5Iar3afeE7rWfF5WpbqjOFtH4vZ/dBVuBxLyGkqRwBFmDF53EUJc58 nB3TflmTqmviQGoDRCSMczYr64HmlDVPzLhlAQ+NORggaRrCIjsCsbNamTcJESPZSqPx /M1dgx32BOfx5NW9tYtD7schD+cC1IDI8G2E08TGzX57Dih76ZldCZNd4++iU+W5Kdq/ ZlR9+t4t8fPBRfQak1bEhtB/dIv7SOpUeMQnoUnL7sf9hLqw0FcXDSW/78GJEBMSjl3U blAQx38SnKgHJtsl8/au3mKoJTxRD7gFGU+CnB/mzVCLijsUVVa1JX+047yfzQfXSxDS 8BMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=iZFUmVL3; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u6si2996852eju.284.2021.07.29.06.57.30; Thu, 29 Jul 2021 06:57:54 -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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=iZFUmVL3; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237839AbhG2Nz2 (ORCPT + 99 others); Thu, 29 Jul 2021 09:55:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237620AbhG2Nz0 (ORCPT ); Thu, 29 Jul 2021 09:55:26 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE480C061765; Thu, 29 Jul 2021 06:55:23 -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=//JteJBlPO/oxjTtV3LASZaFA4G6WCHzkWs4cs97Saw=; b=iZFUmVL3DjXeQg65XLBHJKYW+r ij7voxBE+IDPgeuSPz7voqUndWCfKEe4BwM0Nx49Uer0h//8+3oD9o62dZ6iJ7MeKTIiC9GwN6pja 8Q25jshIVHOAXS/XavTefpp71qH3SOdLJSvYQVsr/wKa091xMOpafpfGWhUnh+aPDUXFW+Lh6rYLQ ZY/8spCb23lWoAi6nVPNAJbrFvBI4yoijzs/Rj77fHaz1wgpd6yvZEXNBV+xI/GYSLqe9TOtLA7sk pkqyZy7ewtzkjO/bGQf6v94jGRPAWzXQ90AeFGQkRITOa2ns2kghh3nmSN6zbJa9KwL7hmNpQyoTM xWxCLu8w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m96Sd-00H7zD-ER; Thu, 29 Jul 2021 13:52:50 +0000 Date: Thu, 29 Jul 2021 14:52:31 +0100 From: Matthew Wilcox To: Miaohe Lin Cc: hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com, akpm@linux-foundation.org, shakeelb@google.com, guro@fb.com, alexs@kernel.org, richard.weiyang@gmail.com, songmuchun@bytedance.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Subject: Re: [PATCH 4/5] mm, memcg: avoid possible NULL pointer dereferencing in mem_cgroup_init() Message-ID: References: <20210729125755.16871-1-linmiaohe@huawei.com> <20210729125755.16871-5-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210729125755.16871-5-linmiaohe@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 29, 2021 at 08:57:54PM +0800, Miaohe Lin wrote: > rtpn might be NULL in very rare case. We have better to check it before > dereferencing it. Since memcg can live with NULL rb_tree_per_node in > soft_limit_tree, warn this case and continue. Why would we need to warn? the GFP flags don't contain NOWARN, so we already know an allocation failed.