Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Jul 2020 14:03:37 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r363446 - head/sys/fs/cuse
Message-ID:  <202007231403.06NE3blK093074@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Thu Jul 23 14:03:37 2020
New Revision: 363446
URL: https://svnweb.freebsd.org/changeset/base/363446

Log:
  cuse: Stop checking for failures from malloc(M_WAITOK).
  
  PR:		240545
  Submitted by:	Andrew Reiter <arr@watson.org>
  Reviewed by:	hselasky
  MFC after:	1 week
  Differential Revision:	https://reviews.freebsd.org/D25765

Modified:
  head/sys/fs/cuse/cuse.c

Modified: head/sys/fs/cuse/cuse.c
==============================================================================
--- head/sys/fs/cuse/cuse.c	Thu Jul 23 14:03:24 2020	(r363445)
+++ head/sys/fs/cuse/cuse.c	Thu Jul 23 14:03:37 2020	(r363446)
@@ -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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007231403.06NE3blK093074>