diff mbox series

[RFC,6/7] HACK: Allow the use of generic decompress with gzip outside __init

Message ID 942e53a4062d7915b5e90e370742f18f42741fbe.1657272362.git.noodles@fb.com (mailing list archive)
State Handled Elsewhere
Headers show
Series ima: Support measurement of kexec initramfs components | expand

Commit Message

Jonathan McDowell July 8, 2022, 10:12 a.m. UTC
The generic decompression support is only available in the __init
section. Hack this out for now with gzip for testing. Longer term this
needs rethought in a similar fashion to the cpio support.

Signed-off-by: Jonathan McDowell <noodles@fb.com>
---
 lib/decompress.c         | 4 ++--
 lib/decompress_inflate.c | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/lib/decompress.c b/lib/decompress.c
index ab3fc90ffc64..89a5709e454a 100644
--- a/lib/decompress.c
+++ b/lib/decompress.c
@@ -48,7 +48,7 @@  struct compress_format {
 	decompress_fn decompressor;
 };
 
-static const struct compress_format compressed_formats[] __initconst = {
+static const struct compress_format compressed_formats[] = {
 	{ {0x1f, 0x8b}, "gzip", gunzip },
 	{ {0x1f, 0x9e}, "gzip", gunzip },
 	{ {0x42, 0x5a}, "bzip2", bunzip2 },
@@ -60,7 +60,7 @@  static const struct compress_format compressed_formats[] __initconst = {
 	{ {0, 0}, NULL, NULL }
 };
 
-decompress_fn __init decompress_method(const unsigned char *inbuf, long len,
+decompress_fn decompress_method(const unsigned char *inbuf, long len,
 				const char **name)
 {
 	const struct compress_format *cf;
diff --git a/lib/decompress_inflate.c b/lib/decompress_inflate.c
index 6130c42b8e59..b245d6e5f8a6 100644
--- a/lib/decompress_inflate.c
+++ b/lib/decompress_inflate.c
@@ -33,6 +33,10 @@ 
 
 #define GZIP_IOBUF_SIZE (16*1024)
 
+/* HACK */
+#undef INIT
+#define INIT
+
 static long INIT nofill(void *buffer, unsigned long len)
 {
 	return -1;