Re: [PATCH v2] kdb: remove usage of static environment buffer
From: Doug Anderson
Date: Mon Feb 10 2025 - 11:31:35 EST
Hi,
On Mon, Feb 3, 2025 at 9:47 PM Nir Lichtman <nir@xxxxxxxxxxxx> wrote:
>
> Problem: The set environment variable logic uses a static "heap" like
> buffer to store the values of the variables, and they are never freed,
> on top of that this is redundant since the kernel supplies allocation
> facilities which are even used also in this file.
>
> Solution: Remove the weird static buffer logic and use kmalloc instead,
> call kfree when overriding an existing variable.
>
> Signed-off-by: Nir Lichtman <nir@xxxxxxxxxxxx>
> ---
>
> v2: Fixes following Doug's CR - use kmalloc_const instead of kmalloc &
> rm redundant print in case of allocation error
>
> include/linux/kdb.h | 2 +-
> kernel/debug/kdb/kdb_main.c | 48 +++++++------------------------------
> 2 files changed, 9 insertions(+), 41 deletions(-)
Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>