git: 16608adccae5 - stable/12 - loader: should check malloc in zfs_dev_open
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 08 Oct 2021 01:16:22 UTC
The branch stable/12 has been updated by kevans:
URL: https://cgit.FreeBSD.org/src/commit/?id=16608adccae5bac11367c71a964d374631ef6a5f
commit 16608adccae5bac11367c71a964d374631ef6a5f
Author: Toomas Soome <tsoome@FreeBSD.org>
AuthorDate: 2019-11-03 13:03:47 +0000
Commit: Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-10-08 01:15:58 +0000
loader: should check malloc in zfs_dev_open
malloc can return NULL.
(cherry picked from commit f4ed0045735d88aa681b4933072ff35a890a86a0)
---
stand/libsa/zfs/zfs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/stand/libsa/zfs/zfs.c b/stand/libsa/zfs/zfs.c
index 3393bcc45052..9386dd7b3729 100644
--- a/stand/libsa/zfs/zfs.c
+++ b/stand/libsa/zfs/zfs.c
@@ -683,6 +683,8 @@ zfs_dev_open(struct open_file *f, ...)
if (!spa)
return (ENXIO);
mount = malloc(sizeof(*mount));
+ if (mount == NULL)
+ return (ENOMEM);
rv = zfs_mount(spa, dev->root_guid, mount);
if (rv != 0) {
free(mount);