From nobody Wed Jul 20 08:47:08 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Lnq7x1mjVz4XQvb; Wed, 20 Jul 2022 08:47:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Lnq7x1GPqz458p; Wed, 20 Jul 2022 08:47:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658306829; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IJlGmESdZhTC4O6BY/KhwdROvqNnAzFRE+ahmyj4a9o=; b=JKBnZYTHT4DRDOEm2GVNACAb54+oy+C9Pqh7Dsv7/5snagb3leSdPpKkosn4p4XTQIdnSe WLvdCOkr6xrHDRXWtbzZZpvYZ0KT5+QrAWQaT1CgtTWy/XuI88uF9LjbTWM3NXDe4djKUM xTGSd9QJjSyAKlxNsiD+PK2HjyjhSMXyzX0stwbeIAGsl0L+I5fRKwhhWIeYVABWRY3NTj cSDO9WCeAGs/VmIoox6DtWjPWrSt1a3+sDL8pUeVLj5SGZXddAYcGepZmCSeLKcWTfhTvN SGZX8dnwdI0lhReOohcnu9EhEcpaAwrgJ+leYc/O86cGTKwDkvICyOSUq8niLQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Lnq7x02MGzsGJ; Wed, 20 Jul 2022 08:47:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 26K8l885075455; Wed, 20 Jul 2022 08:47:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26K8l8cO075454; Wed, 20 Jul 2022 08:47:08 GMT (envelope-from git) Date: Wed, 20 Jul 2022 08:47:08 GMT Message-Id: <202207200847.26K8l8cO075454@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 2ca43c3dba1b - main - cuse(3): Make cuse_vmfree() NULL safe. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2ca43c3dba1b818db9245027c87fddfc9d4be0a6 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658306829; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IJlGmESdZhTC4O6BY/KhwdROvqNnAzFRE+ahmyj4a9o=; b=Fs8UGtT1Y5koz2D1tmSHeHGMIwBWAQgyQV5jBkxOz+GRNP9Fk49/WuFZU2bBBfE1znZqqs B1d6xmHI7aMwpLFPVtPRsAbJt7vFa02vFZwZiWVh6ydaovd5W+lLhvfvK98PSjnbGHIkQE ERNlNI0ZrOKEqBmA5nPoTOfUbEO7AozZa/DWWBL33ng2q4aiANqzXIQpsfT9OPim7NFZ0b 1pyNyuDNSTQwz2rcS6F+ohVqCNgjt2m53zFdevuCNwxT4EOMsB7XI9hx+BeO7BxSDA16L0 gZz3KgrDdRa4+20HnnDvi1HjBogbCS6IsJQF5hV0CDCFjMy095QSAtuKqD0JXA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1658306829; a=rsa-sha256; cv=none; b=wtXid2/h9DL/i9GbtjvNi+trZe+qfLW46ItXNYxFLPVOrcciUCLfMLtOvso5wJpysUZb+Y nidl2uzopDiAfcs3FWCFi+Ufn6s1zlH7LktmmbjRLzJzN9Du/6aV9MJQTspkiFZjCBlfg1 8FnZndl6uZGndKw7GbSIRmZOH4jG2rMm/dxBqn04Wg4QErIHfoGCFbo0esUizUvVqHDNpp fs9wOsJevd3Vau1BKGsb6IIck1sIKhrGiGx8atW0AhVLb0O6vu5mnDawF7H7N6H9NARAzi wchax1U32FOWIBOHN8dtcEK2fEK+aDsCKTLELQNp/pM19Xtj7klfK1uz8id5Ww== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=2ca43c3dba1b818db9245027c87fddfc9d4be0a6 commit 2ca43c3dba1b818db9245027c87fddfc9d4be0a6 Author: Hans Petter Selasky AuthorDate: 2022-07-13 15:54:24 +0000 Commit: Hans Petter Selasky CommitDate: 2022-07-20 08:41:11 +0000 cuse(3): Make cuse_vmfree() NULL safe. MFC after: 1 week Sponsored by: NVIDIA Networking --- lib/libcuse/cuse.3 | 1 + lib/libcuse/cuse_lib.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libcuse/cuse.3 b/lib/libcuse/cuse.3 index 74888a687be8..aab8ebb4d4f4 100644 --- a/lib/libcuse/cuse.3 +++ b/lib/libcuse/cuse.3 @@ -136,6 +136,7 @@ Else this function returns zero. .Fn "cuse_vmfree" "void *" This function frees memory allocated by .Fn cuse_vmalloc . +This function is NULL safe. Note that the cuse library will internally not free the memory until the .Fn cuse_uninit diff --git a/lib/libcuse/cuse_lib.c b/lib/libcuse/cuse_lib.c index fda0c96d0d70..d241ce1dc4ac 100644 --- a/lib/libcuse/cuse_lib.c +++ b/lib/libcuse/cuse_lib.c @@ -269,7 +269,7 @@ cuse_vmfree(void *ptr) int error; int n; - if (f_cuse < 0) + if (f_cuse < 0 || ptr == NULL) return; CUSE_LOCK();