Date: Wed, 27 Jul 2022 09:36:46 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 412b95f77d99 - stable/13 - cuse(3): Make cuse_vmfree() NULL safe. Message-ID: <202207270936.26R9akrs072617@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=412b95f77d9961babfc23b75190e60f86ff42225 commit 412b95f77d9961babfc23b75190e60f86ff42225 Author: Hans Petter Selasky <hselasky@FreeBSD.org> AuthorDate: 2022-07-13 15:54:24 +0000 Commit: Hans Petter Selasky <hselasky@FreeBSD.org> CommitDate: 2022-07-27 09:33:51 +0000 cuse(3): Make cuse_vmfree() NULL safe. Sponsored by: NVIDIA Networking (cherry picked from commit 2ca43c3dba1b818db9245027c87fddfc9d4be0a6) --- 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();
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202207270936.26R9akrs072617>