[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240801132719.GA8788@redhat.com>
Date: Thu, 1 Aug 2024 15:27:19 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: andrii@...nel.org, mhiramat@...nel.org, peterz@...radead.org
Cc: jolsa@...nel.org, rostedt@...dmis.org, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org
Subject: [PATCH v4 3/9] uprobes: simplify error handling for alloc_uprobe()
From: Andrii Nakryiko <andrii@...nel.org>
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>
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>
Reviewed-by: Jiri Olsa <jolsa@...nel.org>
---
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 eb71428691bb..dfe6306a63b1 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);
--
2.25.1.362.g51ebf55
Powered by blists - more mailing lists