mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Biancaa Ramesh <biancaa2210329@ssn.edu.in>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] set initial length of string to 0 instead of 64
Date: Wed, 22 Oct 2025 10:05:28 +0100	[thread overview]
Message-ID: <20251022100528.525644f4@pumpkin> (raw)
In-Reply-To: <20251021172159.47314-1-biancaa2210329@ssn.edu.in>

On Tue, 21 Oct 2025 22:51:59 +0530
Biancaa Ramesh <biancaa2210329@ssn.edu.in> wrote:

Nak

> Signed-off-by: Biancaa Ramesh <biancaa2210329@ssn.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)
>  {


      reply	other threads:[~2025-10-22  9:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-21 17:21 Biancaa Ramesh
2025-10-22  9:05 ` David Laight [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251022100528.525644f4@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=biancaa2210329@ssn.edu.in \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®