Skip to contentSkip to conversation

fprobe: Fix to ensure the number of active retprobes is not zero

PATCH New Masami Hiramatsu (Google) 1 participant 1 message Oct 16, 2023 Tracing

lore
Share & tools
lore

Masami Hiramatsu (Google)

author maintainer
#0 lore raw

PATCH 1/1 fprobe: Fix to ensure the number of active retprobes is not zero

From: Masami Hiramatsu (Google) <[email protected]>

The number of active retprobes can be zero but it is not acceptable, so return EINVAL error if detected.

---
 kernel/trace/fprobe.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/trace/fprobe.c +3 -3
index 3b21f4063258..881f90f0cbcf 100644
@@ -189,7 +189,7 @@ static int fprobe_init_rethook(struct fprobe *fp, int num)
 {
 	int i, size;
 
-	if (num < 0)
+	if (num <= 0)
 		return -EINVAL;
 
 	if (!fp->exit_handler) {
@@ -202,8 +202,8 @@ static int fprobe_init_rethook(struct fprobe *fp, int num)
 		size = fp->nr_maxactive;
 	else
 		size = num * num_possible_cpus() * 2;
-	if (size < 0)
-		return -E2BIG;
+	if (size <= 0)
+		return -EINVAL;
 
 	fp->rethook = rethook_alloc((void *)fp, fprobe_exit_handler);
 	if (!fp->rethook)