[PATCH v3 1/1] eal: update xz read support and ignore warning

Srikanth Yalavarthi syalavarthi at marvell.com
Tue Sep 26 15:49:59 CEST 2023


archive_read_support_filter_xz returns a warning when
compression is not fully supported and is supported
through external program. This warning can be ignored
when reading the files through firmware open as only
decompression is required.

Fixes: 40edb9c0d36b ("eal: handle compressed firmware")
Cc: stable at dpdk.org

Signed-off-by: Srikanth Yalavarthi <syalavarthi at marvell.com>
---
v3:
* removed gerrit change-id

v2: 
* updated code as per review comments


 lib/eal/unix/eal_firmware.c | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/lib/eal/unix/eal_firmware.c b/lib/eal/unix/eal_firmware.c
index d1616b0bd9..16690b4245 100644
--- a/lib/eal/unix/eal_firmware.c
+++ b/lib/eal/unix/eal_firmware.c
@@ -25,19 +25,31 @@ static int
 firmware_open(struct firmware_read_ctx *ctx, const char *name, size_t blocksize)
 {
 	struct archive_entry *e;
+	int err;
 
 	ctx->a = archive_read_new();
 	if (ctx->a == NULL)
 		return -1;
-	if (archive_read_support_format_raw(ctx->a) != ARCHIVE_OK ||
-			archive_read_support_filter_xz(ctx->a) != ARCHIVE_OK ||
-			archive_read_open_filename(ctx->a, name, blocksize) != ARCHIVE_OK ||
-			archive_read_next_header(ctx->a, &e) != ARCHIVE_OK) {
-		archive_read_free(ctx->a);
-		ctx->a = NULL;
-		return -1;
-	}
+
+	if (archive_read_support_format_raw(ctx->a) != ARCHIVE_OK)
+		goto error;
+
+	err = archive_read_support_filter_xz(ctx->a);
+	if (err != ARCHIVE_OK && err != ARCHIVE_WARN)
+		goto error;
+
+	if (archive_read_open_filename(ctx->a, name, blocksize) != ARCHIVE_OK)
+		goto error;
+
+	if (archive_read_next_header(ctx->a, &e))
+		goto error;
+
 	return 0;
+
+error:
+	archive_read_free(ctx->a);
+	ctx->a = NULL;
+	return -1;
 }
 
 static ssize_t
-- 
2.41.0



More information about the stable mailing list