svn commit: r363701 - stable/12/sys/fs/cuse

Mark Johnston markj at FreeBSD.org
Thu Jul 30 14:48:49 UTC 2020


Author: markj
Date: Thu Jul 30 14:48:48 2020
New Revision: 363701
URL: https://svnweb.freebsd.org/changeset/base/363701

Log:
  MFC r363446:
  cuse: Stop checking for failures from malloc(M_WAITOK).

Modified:
  stable/12/sys/fs/cuse/cuse.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/cuse/cuse.c
==============================================================================
--- stable/12/sys/fs/cuse/cuse.c	Thu Jul 30 14:45:05 2020	(r363700)
+++ stable/12/sys/fs/cuse/cuse.c	Thu Jul 30 14:48:48 2020	(r363701)
@@ -425,8 +425,6 @@ cuse_server_alloc_memory(struct cuse_server *pcs, uint
 	int error;
 
 	mem = malloc(sizeof(*mem), M_CUSE, M_WAITOK | M_ZERO);
-	if (mem == NULL)
-		return (ENOMEM);
 
 	object = vm_pager_allocate(OBJT_SWAP, NULL, PAGE_SIZE * page_count,
 	    VM_PROT_DEFAULT, 0, curthread->td_ucred);
@@ -748,8 +746,6 @@ cuse_server_open(struct cdev *dev, int fflags, int dev
 	struct cuse_server *pcs;
 
 	pcs = malloc(sizeof(*pcs), M_CUSE, M_WAITOK | M_ZERO);
-	if (pcs == NULL)
-		return (ENOMEM);
 
 	if (devfs_set_cdevpriv(pcs, &cuse_server_free)) {
 		printf("Cuse: Cannot set cdevpriv.\n");
@@ -1217,10 +1213,6 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd,
 
 		pcsd = malloc(sizeof(*pcsd), M_CUSE, M_WAITOK | M_ZERO);
 
-		if (pcsd == NULL) {
-			error = ENOMEM;
-			break;
-		}
 		pcsd->server = pcs;
 
 		pcsd->user_dev = pcd->dev;
@@ -1430,11 +1422,6 @@ cuse_client_open(struct cdev *dev, int fflags, int dev
 	}
 
 	pcc = malloc(sizeof(*pcc), M_CUSE, M_WAITOK | M_ZERO);
-	if (pcc == NULL) {
-		/* drop reference on server */
-		cuse_server_unref(pcs);
-		return (ENOMEM);
-	}
 	if (devfs_set_cdevpriv(pcc, &cuse_client_free)) {
 		printf("Cuse: Cannot set cdevpriv.\n");
 		/* drop reference on server */


More information about the svn-src-all mailing list