Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7F3ECEE0210 for ; Wed, 13 Sep 2023 22:11:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ozlabs.org; s=201707; t=1694643108; bh=6lsvtHpgBmeqWj7IIfogRL2t/Vh1MTy47LRs1rtsNI8=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=cx4qC8Oh94rLPEMuOkcd4XwJ7Cy711ricC6rL2Ol2YkUYjx95T8eLY6qlrBvYxLUK ui4sZJtxsrm7oOzPKhSLV1IlaDQyu4zS96XwMCzJ9MLkRApzs5nuR4RQd8qSYFfFiN ka92Iriul5P1J9NMqXv2LAnKGdhkRkyQ1F5eMhwzdocEOC76gUx7BCchNYOjFtKdLg bbdgVIMYnLatNv/gjTFhD3XeMUljFJdMGB4Gn/uYrvVcU/jeosFdWR8sRYtUIKeemP nft7VaDULDYMveYGMFdsAN41At6LjboFfNwm6+6JURLfN/38yzuje1shdbl40EckXK k0jkNnY0UZ71w== Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4RmF6X15qvz3cC7 for ; Thu, 14 Sep 2023 08:11:48 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=a4PVXd65; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=flex--dhavale.bounces.google.com (client-ip=2607:f8b0:4864:20::114a; helo=mail-yw1-x114a.google.com; envelope-from=3jtmczqckcywlpiditmowwotm.kwutqvcf-mzwnatqaba.whtija.wzo@flex--dhavale.bounces.google.com; receiver=lists.ozlabs.org) Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4RmF671kLQz3bV7 for ; Thu, 14 Sep 2023 08:11:27 +1000 (AEST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-59b5884836cso3953027b3.0 for ; Wed, 13 Sep 2023 15:11:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694643085; x=1695247885; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6lsvtHpgBmeqWj7IIfogRL2t/Vh1MTy47LRs1rtsNI8=; b=KmTPZMVYmLo23jUlc0CgY+inApw5whIkFFwWjcLqwVD+Flz0L1jnmMa8MrXtPYe23o q7LnP2zw93MwbwrgwCiR+5G7W1H9gRbd0HFb22JDW9GlcoF5fxFl06ZF+CvJjYmfQwnk VTBWpWIzFAprQ7VGiCuputAKKEkgY8XI7O6AYxZoAvIis3s1bjvhmSTmSNlB+IVU5SEl 3cYQhx8vIXuW9zi2nO40BNVPljYftnaeYYBuRUamMMNuq+hR/DNcuSrMRPZREM4D9JA7 qfuUO6AGEFNJS7ufMXymJ2zlRZC1Ce4U/a/86sE+jKUKJ/Cm5t+QVUHmFWlQpXgJfk9P g3Sg== X-Gm-Message-State: AOJu0YwQ24y82SJ2KWdYPYidPNAfENttM3+spf10z0d4txRYbo+8hoqh laOD2w240BdlJ1KINmnlXFIsLLZo9gKXOBNCOnbyhL0YXeoyiH7r5Oe8ICXX6iLODUd8NkSlyzS U1b1dyx5HzvN/sV5SQcqXtJ0GjCQxCdrI7NNAh63XuYq25iKFfzOfHU7RLFtfOYT5AssEL1/S X-Google-Smtp-Source: AGHT+IHEYMqO4nQhX53/652DkGs2/uPMBbX6uOY6tDZghW3ptT/bk4HG48bBU6zrRPNvVRzdtIiv9sQmdkYO X-Received: from dhavale-ctop.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:5e39]) (user=dhavale job=sendgmr) by 2002:a81:b143:0:b0:58c:8c9f:c05a with SMTP id p64-20020a81b143000000b0058c8c9fc05amr103870ywh.9.1694643085183; Wed, 13 Sep 2023 15:11:25 -0700 (PDT) Date: Wed, 13 Sep 2023 15:11:01 -0700 In-Reply-To: <20230913221104.429825-1-dhavale@google.com> Mime-Version: 1.0 References: <20230913221104.429825-1-dhavale@google.com> X-Mailer: git-send-email 2.42.0.283.g2d96d420d3-goog Message-ID: <20230913221104.429825-5-dhavale@google.com> Subject: [PATCH v1 4/7] erofs-utils: lib: Check for error from z_erofs_pack_file_from_fd() To: linux-erofs@lists.ozlabs.org, hsiangkao@linux.alibaba.com Content-Type: text/plain; charset="UTF-8" X-BeenThere: linux-erofs@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development of Linux EROFS file system List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sandeep Dhavale via Linux-erofs Reply-To: Sandeep Dhavale Cc: kernel-team@android.com Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" If z_erofs_pack_file_from_fd() fails, take the error path to free up the allocated resources. Signed-off-by: Sandeep Dhavale --- lib/compress.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/compress.c b/lib/compress.c index 8c79418..81f277a 100644 --- a/lib/compress.c +++ b/lib/compress.c @@ -927,6 +927,8 @@ int erofs_write_compressed_file(struct erofs_inode *inode, int fd) if (cfg.c_all_fragments && !erofs_is_packed_inode(inode) && !inode->fragment_size) { ret = z_erofs_pack_file_from_fd(inode, fd, ctx.tof_chksum); + if (ret) + goto err_free_idata; } else { while (ctx.remaining) { const u64 rx = min_t(u64, ctx.remaining, -- 2.42.0.283.g2d96d420d3-goog