[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f9cabfed7b165299b8048670e548c671f300f2b2.camel@gmail.com>
Date: Thu, 23 Oct 2025 16:01:18 +0530
From: ally heev <allyheev@...il.com>
To: dan.j.williams@...el.com, Dwaipayan Ray <dwaipayanray1@...il.com>, Lukas
Bulwahn <lukas.bulwahn@...il.com>, Joe Perches <joe@...ches.com>, Jonathan
Corbet <corbet@....net>, Andy Whitcroft <apw@...onical.com>
Cc: workflows@...r.kernel.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, Dan Carpenter <dan.carpenter@...aro.org>,
David Hunter <david.hunter.linux@...il.com>, Shuah Khan
<skhan@...uxfoundation.org>, Viresh Kumar <vireshk@...nel.org>, Nishanth
Menon <nm@...com>, Stephen Boyd <sboyd@...nel.org>, linux-pm
<linux-pm@...r.kernel.org>
Subject: Re: [PATCH] checkpatch: add uninitialized pointer with __free
attribute check
On Tue, 2025-10-21 at 09:43 -0700, dan.j.williams@...el.com wrote:
[...]
> Looks good to me, but I why WARN and not ERROR? Is there ever a valid
> reason to ignore this warning?
makes sense. I will make it an ERROR
>
> I would go futher and suggest that the pattern of:
>
> type foo __free(free_foo) = NULL;
>
> ...be made into a warning because that easily leads to situations where
> declaration order is out of sync with allocation order. I.e. can be made
> technically correct, but at a level of cleverness that undermines the
> benefit.
But, does this pattern cause any real issue? I found allocating memory
later useful in cases like below
arch/powerpc/perf/vpa-dtl.c
```
struct vpa_pmu_buf *buf __free(kfree) = NULL;
struct page **pglist __free(kfree) = NULL;
/* We need at least one page for this to work. */
if (!nr_pages)
return NULL;
if (cpu == -1)
cpu = raw_smp_processor_id();
buf = kzalloc_node(sizeof(*buf), GFP_KERNEL,
cpu_to_node(cpu));
```
Powered by blists - more mailing lists