lkml.org 
[lkml]   [2022]   [Aug]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v9 01/27] kallsyms: use `sizeof` instead of hardcoded size
> diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
> index f18e6dfc68c5..52f5488c61bc 100644
> --- a/scripts/kallsyms.c
> +++ b/scripts/kallsyms.c
> @@ -206,7 +206,7 @@ static struct sym_entry *read_symbol(FILE *in)
>
> rc = fscanf(in, "%llx %c %499s\n", &addr, &type, name);
> if (rc != 3) {
> - if (rc != EOF && fgets(name, 500, in) == NULL)
> + if (rc != EOF && fgets(name, sizeof(name), in) == NULL)
> fprintf(stderr, "Read error or end of file.\n");
> return NULL;
> }

Might be another nit, but IMO it's better to use ARRAY_SIZE() here.

\
 
 \ /
  Last update: 2022-08-06 00:41    [W:0.827 / U:0.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site