2022-09-27 13:32:27

by Miguel Ojeda

[permalink] [raw]
Subject: [PATCH v10 01/27] kallsyms: use `ARRAY_SIZE` instead of hardcoded size

From: Boqun Feng <[email protected]>

This removes one place where the `500` constant is hardcoded.

Reviewed-by: Kees Cook <[email protected]>
Signed-off-by: Boqun Feng <[email protected]>
Co-developed-by: Miguel Ojeda <[email protected]>
Signed-off-by: Miguel Ojeda <[email protected]>
---
scripts/kallsyms.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

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;
}
--
2.37.3


2022-09-27 14:21:37

by Geert Stappers

[permalink] [raw]
Subject: Re: [PATCH v10 01/27] kallsyms: use `ARRAY_SIZE` instead of hardcoded size

On Tue, Sep 27, 2022 at 03:14:32PM +0200, Miguel Ojeda wrote:
> From: Boqun Feng <[email protected]>
>
> This removes one place where the `500` constant is hardcoded.
>
> Reviewed-by: Kees Cook <[email protected]>
> Signed-off-by: Boqun Feng <[email protected]>
> Co-developed-by: Miguel Ojeda <[email protected]>
> Signed-off-by: Miguel Ojeda <[email protected]>
> ---
> scripts/kallsyms.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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;
> }
> --
> 2.37.3
>

Reviewed-by: Geert Stappers <[email protected]>


Regards
Geert Stappers
Hopes to see the kallsyms patches getting accepted,
that they don't show up in v11 of the Rust patch serie.
--
Silence is hard to parse

2022-09-27 15:02:53

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v10 01/27] kallsyms: use `ARRAY_SIZE` instead of hardcoded size

On Tue, Sep 27, 2022 at 03:14:32PM +0200, Miguel Ojeda wrote:
> From: Boqun Feng <[email protected]>
>
> This removes one place where the `500` constant is hardcoded.
>
> Reviewed-by: Kees Cook <[email protected]>
> Signed-off-by: Boqun Feng <[email protected]>
> Co-developed-by: Miguel Ojeda <[email protected]>
> Signed-off-by: Miguel Ojeda <[email protected]>
> ---
> scripts/kallsyms.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)


Reviewed-by: Greg Kroah-Hartman <[email protected]>

2022-09-28 15:07:20

by Wei Liu

[permalink] [raw]
Subject: Re: [PATCH v10 01/27] kallsyms: use `ARRAY_SIZE` instead of hardcoded size

On Tue, Sep 27, 2022 at 03:14:32PM +0200, Miguel Ojeda wrote:
> From: Boqun Feng <[email protected]>
>
> This removes one place where the `500` constant is hardcoded.
>
> Reviewed-by: Kees Cook <[email protected]>
> Signed-off-by: Boqun Feng <[email protected]>
> Co-developed-by: Miguel Ojeda <[email protected]>
> Signed-off-by: Miguel Ojeda <[email protected]>

Reviewed-by: Wei Liu <[email protected]>