Skip to content

Commit

Permalink
kallsyms: use ARRAY_SIZE instead of hardcoded size
Browse files Browse the repository at this point in the history
This removes one place where the `500` constant is hardcoded.

Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Geert Stappers <stappers@stappers.nl>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Co-developed-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
  • Loading branch information
Boqun Feng authored and Miguel Ojeda committed Sep 28, 2022
1 parent f76349c commit b66c874
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/kallsyms.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, ARRAY_SIZE(name), in) == NULL)
fprintf(stderr, "Read error or end of file.\n");
return NULL;
}
Expand Down

0 comments on commit b66c874

Please sign in to comment.