[LTP] [PATCH 1/9] metaparse: Print parsing file on verbose

Petr Vorel pvorel@suse.cz
Fri Jan 5 13:03:00 CET 2024


Hi all,

> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  metadata/metaparse.c | 3 +++
>  1 file changed, 3 insertions(+)

> diff --git a/metadata/metaparse.c b/metadata/metaparse.c
> index 2384c73c8..fe6d68911 100644
> --- a/metadata/metaparse.c
> +++ b/metadata/metaparse.c
> @@ -862,6 +862,9 @@ int main(int argc, char *argv[])
>  		return 1;
>  	}

> +	if (verbose)
> +		fprintf(stderr, "\n=== %s ===\n", argv[optind]);
> +

This introduces warning:

$ make metaparse
In file included from metaparse.c:17:
In function ‘data_node_string’,
    inlined from ‘main’ at metaparse.c:894:6:
data_storage.h:84:20: warning: array subscript ‘struct data_node[0]’ is partly outside array bounds of ‘unsigned char[6]’ [-Warray-bounds=]
   84 |         node->type = DATA_STRING;
      |         ~~~~~~~~~~~^~~~~~~~~~~~~
data_storage.h:79:34: note: object of size 6 allocated by ‘malloc’
   79 |         struct data_node *node = malloc(size);
      |                                  ^~~~~~~~~~~~
HOSTCC metadata/metaparse

What am I missing?

>  	res = parse_file(argv[optind]);
>  	if (!res)
>  		return 0;


More information about the ltp mailing list