lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1622623609-7394-1-git-send-email-yejunedeng@gmail.com>
Date:   Wed,  2 Jun 2021 16:46:49 +0800
From:   Yejune Deng <yejune.deng@...il.com>
To:     viro@...iv.linux.org.uk
Cc:     linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        Yejune Deng <yejunedeng@...il.com>
Subject: [PATCH] fs/epoll: Simplify error case

There is only one failure case, so there is no need
to use goto statements and define error.

Signed-off-by: Yejune Deng <yejunedeng@...il.com>
---
 fs/eventpoll.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 1e596e1..b53f263 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -928,15 +928,15 @@ void eventpoll_release_file(struct file *file)
 
 static int ep_alloc(struct eventpoll **pep)
 {
-	int error;
 	struct user_struct *user;
 	struct eventpoll *ep;
 
 	user = get_current_user();
-	error = -ENOMEM;
 	ep = kzalloc(sizeof(*ep), GFP_KERNEL);
-	if (unlikely(!ep))
-		goto free_uid;
+	if (unlikely(!ep)) {
+		free_uid(user);
+		return -ENOMEM;
+	}
 
 	mutex_init(&ep->mtx);
 	rwlock_init(&ep->lock);
@@ -950,10 +950,6 @@ static int ep_alloc(struct eventpoll **pep)
 	*pep = ep;
 
 	return 0;
-
-free_uid:
-	free_uid(user);
-	return error;
 }
 
 /*
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ