[PATCH v2 09/16] xz: Cleanup CRC32 edits from 2018

Lasse Collin posted 16 patches 1 year, 4 months ago
[PATCH v2 09/16] xz: Cleanup CRC32 edits from 2018
Posted by Lasse Collin 1 year, 4 months ago
In 2018, a dependency on <linux/crc32poly.h> was added to avoid
duplicating the same constant in multiple files. Two months later it
was found to be a bad idea and the definition of CRC32_POLY_LE macro
was moved into xz_private.h to avoid including <linux/crc32poly.h>.

xz_private.h is a wrong place for it too. Revert back to the upstream
version which has the poly in xz_crc32_init() in xz_crc32.c.

Fixes: faa16bc404d7 ("lib: Use existing define with polynomial")
Fixes: 242cdad873a7 ("lib/xz: Put CRC32_POLY_LE in xz_private.h")
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Sam James <sam@gentoo.org>
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
---
 lib/xz/xz_crc32.c   | 2 +-
 lib/xz/xz_private.h | 4 ----
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/lib/xz/xz_crc32.c b/lib/xz/xz_crc32.c
index 30b8a27110b1..effdf34ec48d 100644
--- a/lib/xz/xz_crc32.c
+++ b/lib/xz/xz_crc32.c
@@ -28,7 +28,7 @@ STATIC_RW_DATA uint32_t xz_crc32_table[256];
 
 XZ_EXTERN void xz_crc32_init(void)
 {
-	const uint32_t poly = CRC32_POLY_LE;
+	const uint32_t poly = 0xEDB88320;
 
 	uint32_t i;
 	uint32_t j;
diff --git a/lib/xz/xz_private.h b/lib/xz/xz_private.h
index 2412a5d54801..811add814ae4 100644
--- a/lib/xz/xz_private.h
+++ b/lib/xz/xz_private.h
@@ -104,10 +104,6 @@
 #	endif
 #endif
 
-#ifndef CRC32_POLY_LE
-#define CRC32_POLY_LE 0xedb88320
-#endif
-
 /*
  * Allocate memory for LZMA2 decoder. xz_dec_lzma2_reset() must be used
  * before calling xz_dec_lzma2_run().
-- 
2.45.2
Re: [PATCH v2 09/16] xz: Cleanup CRC32 edits from 2018
Posted by Michael Ellerman 1 year, 4 months ago
Lasse Collin <lasse.collin@tukaani.org> writes:
> In 2018, a dependency on <linux/crc32poly.h> was added to avoid
> duplicating the same constant in multiple files. Two months later it
> was found to be a bad idea and the definition of CRC32_POLY_LE macro
> was moved into xz_private.h to avoid including <linux/crc32poly.h>.
>
> xz_private.h is a wrong place for it too. Revert back to the upstream
> version which has the poly in xz_crc32_init() in xz_crc32.c.
>
> Fixes: faa16bc404d7 ("lib: Use existing define with polynomial")
> Fixes: 242cdad873a7 ("lib/xz: Put CRC32_POLY_LE in xz_private.h")
> Cc: Krzysztof Kozlowski <krzk@kernel.org>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: Joel Stanley <joel@jms.id.au>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Reviewed-by: Sam James <sam@gentoo.org>
> Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
> ---
>  lib/xz/xz_crc32.c   | 2 +-
>  lib/xz/xz_private.h | 4 ----
>  2 files changed, 1 insertion(+), 5 deletions(-)

Tested-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)

cheers