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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <172285896501.2215.72648014861106086.tip-bot2@tip-bot2>
Date: Mon, 05 Aug 2024 11:56:05 -0000
From: "tip-bot2 for Andrii Nakryiko" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Andrii Nakryiko <andrii@...nel.org>, Oleg Nesterov <oleg@...hat.com>,
 "Peter Zijlstra (Intel)" <peterz@...radead.org>,
 "Masami Hiramatsu (Google)" <mhiramat@...nel.org>,
 Jiri Olsa <jolsa@...nel.org>, x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip: perf/core] uprobes: simplify error handling for alloc_uprobe()

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     7c2bae2d9c27a89280b63ff3567d2dac2d89db28
Gitweb:        https://git.kernel.org/tip/7c2bae2d9c27a89280b63ff3567d2dac2d89db28
Author:        Andrii Nakryiko <andrii@...nel.org>
AuthorDate:    Thu, 01 Aug 2024 15:27:19 +02:00
Committer:     Peter Zijlstra <peterz@...radead.org>
CommitterDate: Fri, 02 Aug 2024 11:30:31 +02:00

uprobes: simplify error handling for alloc_uprobe()

Return -ENOMEM instead of NULL, which makes caller's error handling just
a touch simpler.

Signed-off-by: Andrii Nakryiko <andrii@...nel.org>
Signed-off-by: Oleg Nesterov <oleg@...hat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Reviewed-by: "Masami Hiramatsu (Google)" <mhiramat@...nel.org>
Reviewed-by: Jiri Olsa <jolsa@...nel.org>
Link: https://lore.kernel.org/r/20240801132719.GA8788@redhat.com
---
 kernel/events/uprobes.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 698bb22..e9b092a 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -725,7 +725,7 @@ static struct uprobe *alloc_uprobe(struct inode *inode, loff_t offset,
 
 	uprobe = kzalloc(sizeof(struct uprobe), GFP_KERNEL);
 	if (!uprobe)
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 
 	uprobe->inode = inode;
 	uprobe->offset = offset;
@@ -1167,8 +1167,6 @@ static int __uprobe_register(struct inode *inode, loff_t offset,
 
  retry:
 	uprobe = alloc_uprobe(inode, offset, ref_ctr_offset);
-	if (!uprobe)
-		return -ENOMEM;
 	if (IS_ERR(uprobe))
 		return PTR_ERR(uprobe);
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ