From: Boqun Feng Date: Wed, 27 Jul 2022 15:58:20 +0000 (+0200) Subject: kallsyms: use `ARRAY_SIZE` instead of hardcoded size X-Git-Tag: block-6.1-2022-13-10~106^2~26 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=b66c874fdb6653aefb3019aeaa9b9f8c1aadd6a0;p=linux-block.git kallsyms: use `ARRAY_SIZE` instead of hardcoded size This removes one place where the `500` constant is hardcoded. Reviewed-by: Kees Cook Reviewed-by: Geert Stappers Reviewed-by: Greg Kroah-Hartman Signed-off-by: Boqun Feng Co-developed-by: Miguel Ojeda Signed-off-by: Miguel Ojeda --- diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index f18e6dfc68c5..8551513f9311 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, ARRAY_SIZE(name), in) == NULL) fprintf(stderr, "Read error or end of file.\n"); return NULL; }