[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4Bzad08Xy3RhcKq=vk_HaZwHXnCxRHp-hC60EY5B7iWkgDg@mail.gmail.com>
Date: Fri, 6 Dec 2024 09:50:39 -0800
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Jiri Olsa <olsajiri@...il.com>
Cc: Andrii Nakryiko <andrii@...nel.org>, 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 Fri, Dec 6, 2024 at 6:07 AM Jiri Olsa <olsajiri@...il.com> wrote:
>
> 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
>
Doh, of course, sorry, my stupid mistake. I'll send a follow up fix.
> 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