[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z1MFHg3fd_BMQtve@krava>
Date: Fri, 6 Dec 2024 15:07:26 +0100
From: Jiri Olsa <olsajiri@...il.com>
To: Andrii Nakryiko <andrii@...nel.org>
Cc: linux-trace-kernel@...r.kernel.org, peterz@...radead.org,
mingo@...nel.org, oleg@...hat.com, rostedt@...dmis.org,
mhiramat@...nel.org, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org, liaochang1@...wei.com,
kernel-team@...a.com
Subject: Re: [PATCH perf/core 1/4] uprobes: simplify session consumer tracking
On Thu, Dec 05, 2024 at 04:24:14PM -0800, Andrii Nakryiko wrote:
SNIP
> static struct return_instance *alloc_return_instance(void)
> {
> struct return_instance *ri;
>
> - ri = kzalloc(ri_size(DEF_CNT), GFP_KERNEL);
> + ri = kzalloc(sizeof(*ri), GFP_KERNEL);
> if (!ri)
> return ZERO_SIZE_PTR;
>
> - ri->consumers_cnt = DEF_CNT;
> return ri;
> }
>
> static struct return_instance *dup_return_instance(struct return_instance *old)
> {
> - size_t size = ri_size(old->consumers_cnt);
> + struct return_instance *ri;
> +
> + ri = kmemdup(old, sizeof(*ri), GFP_KERNEL);
missing ri == NULL check
jirka
> +
> + if (unlikely(old->cons_cnt > 1)) {
> + ri->extra_consumers = kmemdup(old->extra_consumers,
> + sizeof(ri->extra_consumers[0]) * (old->cons_cnt - 1),
> + GFP_KERNEL);
> + if (!ri->extra_consumers) {
> + kfree(ri);
> + return NULL;
> + }
> + }
>
> - return kmemdup(old, size, GFP_KERNEL);
> + return ri;
> }
>
> static int dup_utask(struct task_struct *t, struct uprobe_task *o_utask)
> @@ -2369,25 +2372,28 @@ static struct uprobe *find_active_uprobe_rcu(unsigned long bp_vaddr, int *is_swb
> return uprobe;
> }
>
> -static struct return_instance*
SNIP
Powered by blists - more mailing lists