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 707BFC77B7F for ; Mon, 8 May 2023 16:15:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0174B6B0071; Mon, 8 May 2023 12:15:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F08D06B0074; Mon, 8 May 2023 12:15:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF7FA6B0075; Mon, 8 May 2023 12:15:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id D38106B0071 for ; Mon, 8 May 2023 12:15:04 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A3FC4ADA65 for ; Mon, 8 May 2023 16:15:04 +0000 (UTC) X-FDA: 80767586928.29.ACCE24E Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by imf13.hostedemail.com (Postfix) with ESMTP id D247B20009 for ; Mon, 8 May 2023 16:15:01 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=fail ("headers rsa verify failed") header.d=mit.edu header.s=outgoing header.b=el0V0w3t; spf=pass (imf13.hostedemail.com: domain of tytso@mit.edu designates 18.9.28.11 as permitted sender) smtp.mailfrom=tytso@mit.edu; dmarc=pass (policy=none) header.from=mit.edu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1683562502; 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=3yxhxZv//0lwbrrlJ0FBf69IOB3kNLzDF0lKVItgTQE=; b=mIn5OVa3m1nhB24tIIg5OIu3BZQD1UgsesU6ID50BGDl7UDmEml+6z5k08cq02Y5vPAgqz oDP8KvtkShzLWr8wV7qShriYR+iY4QzaY+AgJUESIhysGT70hlJrjHNknv2Q5GBcvZFW5i 6mtvH7r+oj6OgOk4GVFIAAypWN9YuVI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683562502; a=rsa-sha256; cv=none; b=2jLB3VTTnUpE36ij+cIZeM2nHLdUAaFDGxx3kqt2P6UasrCoxHh94aPU7JI+zFLkBA3eT6 rIM0DJy+34/POultGJDImo41CaDlBxq6Vq16AjQJFdVwhSUpIFFW3lcit2+LSuPs0SAUFc Xx5hFFTR68ZThPux8Aqjtg6dFKEyBoc= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=fail ("headers rsa verify failed") header.d=mit.edu header.s=outgoing header.b=el0V0w3t; spf=pass (imf13.hostedemail.com: domain of tytso@mit.edu designates 18.9.28.11 as permitted sender) smtp.mailfrom=tytso@mit.edu; dmarc=pass (policy=none) header.from=mit.edu 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-Stat-Signature: dq8gynutynr5hmcz5suta8ix8otex8e9 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: D247B20009 X-HE-Tag: 1683562501-740555 X-HE-Meta: U2FsdGVkX1/vRZ1Pd2gGogAc4QWJ0y5rfezZ75LmKJZbe8E+RY0gUZ0F4yP2m4G4wbpiETd8tgfgz63GxBSQqZa8eV+L+0xecaZtST0WCjbk0Twxv0PvhJDKmB1WRNcDGXTLDqeUG/0AcSRyHA3E4Ccu8ODhwnwf6M6rbDh0eHozykmKoJnwWsPAtV6QkLylawH19dSa0wce6+1UApuSTxDtMatAF3BwEqMgSZ2MNbFRGC5kGjoitvBsQQCVVLxPeLjzjDgURDLktPHWYMtt0c6mKePZqeAEOQfh/FrcvFx243ixvKO/DCi/9V2OIfI4asawTqIZUFl+XoF8nd2AVhtmZyU7iylbUenInKSspQikJI8VFJetn+o1q/kB37wyks6fPs98ZbJZI2s51P7mEXUKaO09Dmm9NuC2sR5LgxApxUWzgqG8rX7OSv1tmMVVFSXKIVOHPjo6Gj0cbSeml/KpU/LjCedrijv9V9OtCYATUutafQyidwjprh0rxsNyjtjDMRb/9M2yMxXw9SH3FcwCc43D6WIZIhBudXs7OIWkpQASMCwG722Zoi6/5xB618ilnnAfJpBu56pzZN+8CNL+mRuMcM9Hu335AOBdaaEDp95vyXBjm7t1ovavlgDp003dyEHFFeNFZnFfL9PA6TSV5WhKmCFj/se6rEu1yHga8YCMoNcnJX02imj4nNhYcJkdj4H5GOOvW6Kr3ENYtogEL8bW13CoRma20p/VrESJscMa811DNXhYX5s8hKylKpkHH9uFHqV3lnLfgVPsJnCnRdy9DeOfF8Sx9hK15w7abBbMZeR3PTK+YDpFUMsflKTnfstmijzQeM/nBvshNXOrwZdKRmv0dANinHGmUB/6LtQIaqOHwiP5wq8nhaFWd38ds6bilGB/pMNpRfMDylPPyfjGbW99uuKXIr0lhx5HlrJqvEhyqOwdFkxunNRE9W9Fs/o67S8mf5FExuS z6o94UGI i5l/2FCuXXTogiArZvzjhp2T9yMyPYjyhU1T8OFhAPIxyp24xUGHKEeFPyAZlBLrzWw2nAkskbCsfbFc+pSl3++AUn2ttY0jCfjHnNW9AosCbEFWPQw3XHJHEQVc5c/pGq3a40bgRdmc3x17sHjstPOKiu8eSCmoPH2QC69HlvFsZ9kJ6eVhmrBeoJupZQRCObxqAEzCS5vmLyxDqbq83Gk1fepbOnBVQ1ZZnQAdLq1NFYafyTv14EvAXyLaJUMHOTnkFi4IFxBxFsj8zDVglyRVolg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.024088, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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