From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AE0EF425E9 for ; Mon, 25 Sep 2023 11:10:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A56AA406A2; Mon, 25 Sep 2023 11:10:22 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 1198D402CC for ; Mon, 25 Sep 2023 11:10:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695633019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C3E89wBhC7aZcOg7YW+yWCYpupnqxaT4SCnkeFilDHE=; b=RBlRdOdkaFrSuRllvNNeqm9CoBWvHqTa47ds3xiWGwJJKATf+4ccHWKci52jDxV9LfBJ5c qtuH64U9ChDMnRRnHfTpFsASbKo/bHJ+BIdbnJ6r9uhtPyBqqgQGyXe6vuwsCtRc0oddgy g4Wm0aC0abOU+/+yTyqrHkxZUwbMRiU= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-269-90CyC4HnO6m_n-5FAq_AUA-1; Mon, 25 Sep 2023 05:10:18 -0400 X-MC-Unique: 90CyC4HnO6m_n-5FAq_AUA-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2c135cf124cso68148521fa.2 for ; Mon, 25 Sep 2023 02:10:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695633016; x=1696237816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C3E89wBhC7aZcOg7YW+yWCYpupnqxaT4SCnkeFilDHE=; b=KS3q89WL6pOpXSRdKCLrdASmqxTni3MHAjbixB8h9xPIyJpIsnOjTZ1Rs4NYa0e4tR CG0h8uBXwYStWMn3cDW/rRXcxYa+lVe2pDSSOWdNj/VbNybVnOyz+gs1BPeXDXrGExfa 39lbPyn4OxsOZcWc3ymqIkmCZ3lT2d/bmF8ii6OgrzdhzGl6RY3abtBL/o/dOMS7Dvqp ejCboiNbew2wlNdF4w8UF+8Y7yw2VPOoyElN272Pl5Hh7kTPyS/xDyieQArJxmvXL/J1 0gR4cVz6N3RS3AcR1QQHDg0uMw/JV7yyh/L1N5snxWPKkC1hc5tzqVd6yPKjYUT5F/8k 7WLg== X-Gm-Message-State: AOJu0YwZeNvSt0jFwz1eL/0iux+fvsjK2QB5LcWM2wjFdjX8TtclFS0n xOyj3KM+vFyy2G6BlHJhuaSeseEu1UxtuAFQVwoydiXHBKD2P7tMxlSuduBZNuSZP6LI56/u1DG ZjnXO/3OH9DsGPp/yxH0Tgwk= X-Received: by 2002:a2e:b004:0:b0:2c1:2995:b671 with SMTP id y4-20020a2eb004000000b002c12995b671mr5398442ljk.42.1695633016660; Mon, 25 Sep 2023 02:10:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYrXwMY2NMCgZ2e0CI1uMxccd6PljBAHjwYe5ETA9bYhqSBQVQk3/Sdx/EqoAjaqqMDApiqzXNjG1gF3QC81Q= X-Received: by 2002:a2e:b004:0:b0:2c1:2995:b671 with SMTP id y4-20020a2eb004000000b002c12995b671mr5398433ljk.42.1695633016329; Mon, 25 Sep 2023 02:10:16 -0700 (PDT) MIME-Version: 1.0 References: <20230922165356.31567-1-syalavarthi@marvell.com> In-Reply-To: <20230922165356.31567-1-syalavarthi@marvell.com> From: David Marchand Date: Mon, 25 Sep 2023 11:10:04 +0200 Message-ID: Subject: Re: [PATCH 1/1] eal: enable xz read support and ignore warning To: Srikanth Yalavarthi Cc: Aaron Conole , Igor Russkikh , dev@dpdk.org, sshankarnara@marvell.com, aprabhu@marvell.com, ptakkar@marvell.com, jerinjacobk@gmail.com, stable@dpdk.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hello, Thank you for the patch. On Fri, Sep 22, 2023 at 6:54=E2=80=AFPM Srikanth Yalavarthi wrote: > > 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. - I don't understand the last sentence, it seems to state something about *only* needing decompression support but well, archive_read_support_filter_xz (like archive_read_support_filter_* other helpers) *is about* decompressing a file. - I can't reproduce this ARCHIVE_WARN thing, not sure which libarchive you use, or which knob/build option triggered this behavior you observe. So I need you to to double check how this change affects the code. Please pass a xz-compressed mldev fw .bin file and confirm it still works. > > Fixes: 40edb9c0d36b ("eal: handle compressed firmware") > Cc: stable@dpdk.org > > Signed-off-by: Srikanth Yalavarthi > --- > lib/eal/unix/eal_firmware.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/lib/eal/unix/eal_firmware.c b/lib/eal/unix/eal_firmware.c > index d1616b0bd9..05c06c222a 100644 > --- a/lib/eal/unix/eal_firmware.c > +++ b/lib/eal/unix/eal_firmware.c > @@ -25,12 +25,19 @@ static int > firmware_open(struct firmware_read_ctx *ctx, const char *name, size_t bl= ocksize) > { > struct archive_entry *e; > + int err; > > ctx->a =3D archive_read_new(); > if (ctx->a =3D=3D NULL) > return -1; > + > + err =3D archive_read_support_filter_xz(ctx->a); > + if (err !=3D ARCHIVE_OK && err !=3D ARCHIVE_WARN) { > + ctx->a =3D NULL; > + return -1; > + } - This patch leaks ctx->a content on error. Plus I prefer we keep the original order of the code because it matches what libarchive does: first look for an archive format, then next look for compression matters. The simpler is to add an error label like I did in the debug patch. Something like: diff --git a/lib/eal/unix/eal_firmware.c b/lib/eal/unix/eal_firmware.c index d1616b0bd9..269688d550 100644 --- a/lib/eal/unix/eal_firmware.c +++ b/lib/eal/unix/eal_firmware.c @@ -25,19 +25,27 @@ static int firmware_open(struct firmware_read_ctx *ctx, const char *name, size_t blocksize) { struct archive_entry *e; + int err; ctx->a =3D archive_read_new(); if (ctx->a =3D=3D NULL) return -1; - if (archive_read_support_format_raw(ctx->a) !=3D ARCHIVE_OK || - archive_read_support_filter_xz(ctx->a) !=3D ARCHIVE= _OK || - archive_read_open_filename(ctx->a, name, blocksize) !=3D ARCHIVE_OK || - archive_read_next_header(ctx->a, &e) !=3D ARCHIVE_O= K) { - archive_read_free(ctx->a); - ctx->a =3D NULL; - return -1; - } + if (archive_read_support_format_raw(ctx->a) !=3D ARCHIVE_OK) + goto error; + err =3D archive_read_support_filter_xz(ctx->a); + if (err !=3D ARCHIVE_OK && err !=3D ARCHIVE_WARN) + goto error; + if (archive_read_open_filename(ctx->a, name, blocksize) !=3D ARCHIV= E_OK) + goto error; + if (archive_read_next_header(ctx->a, &e)) + goto error; + return 0; + +error: + archive_read_free(ctx->a); + ctx->a =3D NULL; + return -1; } static ssize_t --=20 David Marchand