]> www.infradead.org Git - users/dwmw2/linux.git/commit
genksyms: use uint32_t instead of unsigned long for calculating CRC
authorMasahiro Yamada <masahiroy@kernel.org>
Fri, 3 Jan 2025 07:30:43 +0000 (16:30 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Fri, 10 Jan 2025 14:01:22 +0000 (23:01 +0900)
commita56fece7f302ff1eb49535e66bdd5d03ced0ca20
tree02fb502898c14ebd3be8f848d986afceb310aadd
parent2759bd908f3cc8d286e1fa64ec7ee7f5d1124837
genksyms: use uint32_t instead of unsigned long for calculating CRC

Currently, 'unsigned long' is used for intermediate variables when
calculating CRCs.

The size of 'long' differs depending on the architecture: it is 32 bits
on 32-bit architectures and 64 bits on 64-bit architectures.

The CRC values generated by genksyms represent the compatibility of
exported symbols. Therefore, reproducibility is important. In other
words, we need to ensure that the output is the same when the kernel
source is identical, regardless of whether genksyms is running on a
32-bit or 64-bit build machine.

Fortunately, the output from genksyms is not affected by the build
machine's architecture because only the lower 32 bits of the
'unsigned long' variables are used.

To make it even clearer that the CRC calculation is independent of
the build machine's architecture, this commit explicitly uses the
fixed-width type, uint32_t.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/genksyms/genksyms.c