[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251022100528.525644f4@pumpkin>
Date: Wed, 22 Oct 2025 10:05:28 +0100
From: David Laight <david.laight.linux@...il.com>
To: Biancaa Ramesh <biancaa2210329@....edu.in>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] set initial length of string to 0 instead of 64
On Tue, 21 Oct 2025 22:51:59 +0530
Biancaa Ramesh <biancaa2210329@....edu.in> wrote:
Nak
> Signed-off-by: Biancaa Ramesh <biancaa2210329@....edu.in>
> ---
> scripts/kconfig/util.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c
> index 176ec03bb3f0..f55e3ce496e1 100644
> --- a/scripts/kconfig/util.c
> +++ b/scripts/kconfig/util.c
> @@ -64,13 +64,14 @@ const char *file_lookup(const char *name)
> struct gstr str_new(void)
> {
> struct gstr gs;
> - gs.s = xmalloc(sizeof(char) * 64);
> - gs.len = 64;
> + gs.s = xmalloc(64); // allocate buffer
That is 'no-change'.
> + gs.len = 0; // string is empty
I'm pretty sure gs.len is the size of the buffer, so should be 64.
> gs.max_width = 0;
> - strscpy(gs.s, "\0");
Where did that strscpy() come from, it is wrong and shouldn't compile.
> + gs.s[0] = '\0'; // initialize as empty string
Equivalent to the strcpy() in 6.18-rc2.
> return gs;
> }
>
> +
> /* Free storage for growable string */
> void str_free(struct gstr *gs)
> {
Powered by blists - more mailing lists