Re: [PATCH] kdb: remove usage of static environment buffer
From: Nir Lichtman
Date: Tue Feb 04 2025 - 00:40:42 EST
On Mon, Feb 03, 2025 at 01:13:31PM -0800, Doug Anderson wrote:
> Hi,
>
> On Mon, Feb 3, 2025 at 12:20 PM Nir Lichtman <nir@xxxxxxxxxxxx> wrote:
> >
> > @@ -348,9 +315,12 @@ static int kdb_setenv(const char *var, const char *val)
> >
[..]
> > + kdb_printf("Could not allocate space for the env var: %s\n",
> > + var);
>
> You don't need the printout. kmalloc is already very shouty if memory
> allocations fail.
>
>
> > + return KDB_KMALLOCFAILED;
[..]
> > + kfree(__env[i]);
>
> I haven't tested it, but shouldn't the above be kfree_const() instead
> of kfree()? Otherwise won't you be trying to kfree() the initial
> strings? ...or am I missing something?
Hi Doug,
Thanks for the review, you're right, my bad, I'll fix to use kfree_const.
Sending shortly a v2 with the fixes.
Nir
>
>
> -Doug