summaryrefslogtreecommitdiffstats
path: root/kernel/events
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2024-08-01 15:27:19 +0200
committerPeter Zijlstra <peterz@infradead.org>2024-08-02 11:30:31 +0200
commit7c2bae2d9c27a89280b63ff3567d2dac2d89db28 (patch)
tree2a108010d8f8030af28682072bfefea0addba918 /kernel/events
parentuprobes: is_trap_at_addr: don't use get_user_pages_remote() (diff)
downloadlinux-7c2bae2d9c27a89280b63ff3567d2dac2d89db28.tar.xz
linux-7c2bae2d9c27a89280b63ff3567d2dac2d89db28.zip
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@kernel.org> Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: "Masami Hiramatsu (Google)" <mhiramat@kernel.org> Reviewed-by: Jiri Olsa <jolsa@kernel.org> Link: https://lore.kernel.org/r/20240801132719.GA8788@redhat.com
Diffstat (limited to 'kernel/events')
-rw-r--r--kernel/events/uprobes.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 698bb22f7102..e9b092acc71b 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);