Re: [PATCH 1/1] kconfig: incorrect 'len' field initialisation ?

Sam Ravnborg
2008-05-19T06:38:41Z

On Sun, May 18, 2008 at 11:10:24PM +0200, Christophe Jaillet wrote:
> From: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
>
> Hi, here is a patch against /scripts/kconfig/util.c :
>
> 1) The field 'len' of the 'gstr' structure seems to track the size of the memory
> already allocated for the "growable string". So the value of this field should be
> the same as the 'malloc()' just above, shouldn't it ?
>
>
>
> Note: this patch is based on 'linux-2.6.25.tar.bz2'
>
> Signed-off-by: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
>
> ---
>
> --- linux 2.6.25/scripts/kconfig/util.c 2008-04-17 04:49:44.000000000 +0200
> +++ linux 2.6.25/scripts/kconfig/util.c.cj 2008-05-18 22:56:14.000000000 +0200
> @@ -77,7 +77,7 @@ struct gstr str_new(void)
> {
> struct gstr gs;
> gs.s = malloc(sizeof(char) * 64);
> - gs.len = 16;
> + gs.len = 64;
> strcpy(gs.s, "\0");
> return gs;
> }

Thanks Christophe.
Obviously correct - I will apply to kbuild-fixes.git.

Sam