Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4567327rwr; Mon, 8 May 2023 09:24:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ60s69Bu21mIHWtKNMOEOkcr9g6ILyOUXHN2wyV6YzKdO6SofMAvIRBBm3ssKaELMQ5ubFy X-Received: by 2002:a05:6a20:2443:b0:ff:ccee:8e95 with SMTP id t3-20020a056a20244300b000ffccee8e95mr9252689pzc.48.1683563041873; Mon, 08 May 2023 09:24:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683563041; cv=none; d=google.com; s=arc-20160816; b=XZzDoiHnlkTOrXeenFiKRRCm3yILgSA1njmQf7s8sa9zCDNc0ZsFwJCUdl7pyu7PRG nzXp9k7z6L6puZkIEAxoF0yr2CCb5Lx8j2A84M+RuHvaWwpN3S0Ta7acrR6CTlKrNpuE apDZiM6R5vMAIZzR8/COmKPmbGvnT2ielt2LtoigoN+AaBJTLVOYKn2b0xJ8jWBP0BA1 +FpXeJVTgfPVcetAVjDaa7lHhYt444prTnbqoEI3abc4fG/sFT1GOUa0M53OFh3puOGC tqSNeKzb59jKAgjuOMCwKpFQHL7VyBLCOL3B1UmJAGWXmbyGUArZ3IBrvu6NVkw1tjl8 IR9A== 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=3yxhxZv//0lwbrrlJ0FBf69IOB3kNLzDF0lKVItgTQE=; b=JiEkdiYY9ujVOQqEPMyIbFEpcvF7tgGmsQAHBsNU9nIzPmWAPf9F0htkamBZ8L6FEZ MLgo9bzWvIPeugrEcwc6C5Cte6CR6NPkspMXNU/QVjGdVWSFE8udnKhcJ2C4zFmYn5Cn qofhygWLrLKUMHz0yP/qUDfQLC2shElOfYukJHuCMnbMkPadjKm0fnfrcenWhvUEz4i1 bYH/CxMT4zWFPCS3TrmrD6xmtKdYAOJdHtxPTzVsouPjW19cbWU6T4O0p3njlS4ztf9v wXdAj382xQgVoQjRHK59DGnSc71qVvgJlITVZ5vhtfteWP5js5t535CuFZW0N7zu5aJh y8PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mit.edu header.s=outgoing header.b=el0V0w3t; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p20-20020a637414000000b0051b618ec7d0si8727517pgc.617.2023.05.08.09.23.44; Mon, 08 May 2023 09:24:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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=fail header.i=@mit.edu header.s=outgoing header.b=el0V0w3t; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232900AbjEHQPK (ORCPT + 99 others); Mon, 8 May 2023 12:15:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232748AbjEHQPJ (ORCPT ); Mon, 8 May 2023 12:15:09 -0400 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2761D49D7 for ; Mon, 8 May 2023 09:15:08 -0700 (PDT) Received: from letrec.thunk.org (vancouverconventioncentre.com [72.28.92.215] (may be forged)) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 348GEt8W000886 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 8 May 2023 12:14:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mit.edu; s=outgoing; t=1683562498; bh=3yxhxZv//0lwbrrlJ0FBf69IOB3kNLzDF0lKVItgTQE=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=el0V0w3tN9DyVl8Jbyg2HyL1S2OiLV2X+ZXkRvxcQW7rHlfkvQjNDXz+JP5r1Fa9g 22stNJE3wOYgqqtiD3DL8F5KpEp9+DiFHsyfaYtnmJblmxJe0BMHk2W2WlqGqK2WYA 2bkx7pb9Io+QgKAGK5Bw+wQcBp3LCxH4PM6221qDXjTK2q7udaLHIuB9ssnN1+aGCQ 8FpZNzjqpZvzDkuVIgMCW0ww64VKi39jGJdbhVutO4hCjsPzvPjx773OojarX6guxc ogcJyEHAMeM6oQM4snEz4opKtxZfu77+4jTxPv9n2YSixi/qO1sqdHkx62C5YK/K0g rU26k1jr5JFAw== Received: by letrec.thunk.org (Postfix, from userid 15806) id ABF8C8C03A6; Mon, 8 May 2023 12:14:54 -0400 (EDT) Date: Mon, 8 May 2023 12:14:54 -0400 From: "Theodore Ts'o" To: Tudor Ambarus Cc: adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, joneslee@google.com, linux-mm@kvack.org Subject: Re: [PATCH] ext4: remove superfluous check that pointer is not NULL Message-ID: References: <20230508151337.79304-1-tudor.ambarus@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230508151337.79304-1-tudor.ambarus@linaro.org> X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAY_BE_FORGED,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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-ext4@vger.kernel.org On Mon, May 08, 2023 at 03:13:37PM +0000, Tudor Ambarus wrote: > If @buffer is NULL, no operation is performed for kvfree(buffer), > remove superfluous check. > > Signed-off-by: Tudor Ambarus I was looking at this just a few weeks ago, and I couldn't find any actual *documentation* that it was safe to call vfree(NIILL) or kvfree(NULL). The problem is there are a lot of architecture-specific functions, and unlike with kfree() there is no top-level "if (ptr == NULL) return;" in the top-level vfree() and kvfree(). So I thought about removing the NULL check for kvfree(), and ultimately chickened out, since I was afraid that there might be crashes for some obscure architecture or kernel CONFIG setup. I've added linux-mm@ for their comments, and for a plea that if it is safe to pass NULL to vfree, kvfree, kvfree_rcu, etc. that it actually be *documented* somewhere. - Ted