Re: [PATCH v7 01/25] kallsyms: avoid hardcoding the buffer size

From: Jarkko Sakkinen
Date: Mon May 23 2022 - 15:47:07 EST


On Mon, May 23, 2022 at 04:01:14AM +0200, Miguel Ojeda wrote:
> From: Boqun Feng <boqun.feng@xxxxxxxxx>
>
> This makes it easier to update the size later on.
>

This does not really conform to [1].

E.g.

"Declare KSY_NAME_LEN, which describes the maximum length for a kernel
symbol read by kallsyms from the input. In read_symbol(), define the
buffer to be of length "KSY_NAME_LEN + 1", which includes the terminator
character."

would be better.

> Furthermore, a static assert is added to ensure both are updated
> when that happens. The relationship used is one that keeps the new
> size (512+1) close to the original buffer size (500).

You must split this then into two patches:

1. A patch that re-defines the length with KSYM_NAME_LEN, i.e.
#define KSYM_NAME_LEN 499
2. A patch which increases the size and reasoning for that.

Right now bundles two separate changes, which does not conform to [2].

BR, Jarkko