From patchwork Tue Nov 9 08:17:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederic Germain X-Patchwork-Id: 1552775 X-Patchwork-Delegate: david.oberhollenzer@sigma-star.at Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=hatOkNyd; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=et68jY9z; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HpLV35HQfz9sCD for ; Tue, 9 Nov 2021 19:18:49 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RyiIyvvaIucD5rlhjkHrPmmqGXsmXw1IqC9SUr1sNL8=; b=hatOkNyda8IJt6 f+a/wddDeCa6q+3TZl7qFhYgaky69AKyE0jw0KviBEMMC25Dd89jnTLoZsJXByyGzMR9kj1O9dTU4 9ZtxnNlToHD+De2UnL0PAvbysnK0G+rOsGvRYabOGoheZ4x3Wkl9HNNujsovEEMLt8BlJfWkPcpNl 20gBMLOPKpdVZAr+sjVJY7Wd1fIaWugRiLKdhUaFT/By6HFemwDDqdJJYQMc1P0RB7/HmhQTqu6Sg nNbR86j1XNl0m2SWXBe+d4U0+t/nbiRpoYaUX4sHIOa2XJIK68gOOXW3/kcOV4nT3mW3dinBArNLI jhriejWNsY3Pk8Y/72kQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkMKj-000xOi-2s; Tue, 09 Nov 2021 08:18:21 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkMKd-000xN0-Gi for linux-mtd@lists.infradead.org; Tue, 09 Nov 2021 08:18:16 +0000 Received: by mail-wm1-x333.google.com with SMTP id 67-20020a1c1946000000b0030d4c90fa87so1625479wmz.2 for ; Tue, 09 Nov 2021 00:18:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5dVXpCTzCFlYzdQbeW4S2Yh6RgxNGbAVKiBMgmJgIi4=; b=et68jY9zVGoK2NjBJO8wQLIwjoBgQdgXn5ZGsl03yf4afhalTN2Rklosiq2fpfuNTk wnufa+RbxOYL1dh75Cxf5h6nDr51/xOABdLxjHkd6RL82lPPMiXv4ByuDGpG/5z0F0/p RxAnzF8mrmQG4chW7oJ4Azyf5XOdPpnEOyXYVRWl+ZDb2/OqDGJqeq+ZbSIPjJgiqcTg rIU8tj6v8X3k1z5zHFGkqYd3LY8ehEqXtZatZdYswYav0aR3R09KS/PQMgo6s/jGE2xI H1WDuPS5cJa4q8iEmivR5A0fUZSnUkd5dF/lhvLxjO9tRQCAp8J1u1O0nTRLe4Jlrs9u cEmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5dVXpCTzCFlYzdQbeW4S2Yh6RgxNGbAVKiBMgmJgIi4=; b=MmEq+UhoNvrtTw/AnXpCE3GWKZzhGpc01/kpjp1dTvE6O5k3sIIvpxGJKGCKb2VTlV Wj1jjxE0sFCs/tja1UVV4UoIC4OTdzVjsqttT4nxQsQgRyTCg+GICazv7fjEb9o52gNU TwdtzHlmGdZ7tES8BK5Ua9NopgcTCsbP21x1l7++xd3f4Km5nRUFW9Vr7DD8PF74aqwi sJo+EVTCcJL5B8TXmULTA2ESSnV3BF4vAXDpnW5lU3Gu3my2ySy5jKa6sUa7jXbFuUlc OZpetsxgK3kL2+Zm6BdE+XuPY2v6Vwei5w44nKHeYL7PSK9aoeuBKFQLO41yr1YXAegn U8pg== X-Gm-Message-State: AOAM532XPR1s8Pq+rvnzMhy6nWp5/7Ov/SQAUwyU0Lj+O3XJJiuTLxvh cm3K4nP2J/xiMMxPZzKmd/djHxYJAPGCkSPR X-Google-Smtp-Source: ABdhPJyR/DcdEseFDBpTuZGypjDRXrDrvUfOoCShBbaJHZQ17WmKFHJHpZ8mzsjYN/l8cKfzootTqg== X-Received: by 2002:a05:600c:3b0a:: with SMTP id m10mr5033854wms.130.1636445893962; Tue, 09 Nov 2021 00:18:13 -0800 (PST) Received: from thor.lan ([213.205.241.131]) by smtp.gmail.com with ESMTPSA id n184sm1714028wme.2.2021.11.09.00.18.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Nov 2021 00:18:13 -0800 (PST) From: Frederic Germain To: linux-mtd@lists.infradead.org Cc: Frederic Germain Subject: [PATCH 1/4] .gitignore: add new ubiscan utility Date: Tue, 9 Nov 2021 08:17:48 +0000 Message-Id: <20211109081751.480718-2-frederic.germain@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211109081751.480718-1-frederic.germain@gmail.com> References: <20211109081751.480718-1-frederic.germain@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211109_001815_574329_9246D9E4 X-CRM114-Status: UNSURE ( 8.71 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Signed-off-by: Frederic Germain --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 1644ef0..8c51ee5 100644 --- a/.gitignore +++ b/.gitignore @@ -100, 6 +100, 7 @@ ubinize ubirename ubirmvol ubirsvol +ubiscan ubiupdatevol volrefcnt mtdlib_test [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:333 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [frederic.germain[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Frederic Germain --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 1644ef0..8c51ee5 100644 --- a/.gitignore +++ b/.gitignore @@ -100,6 +100,7 @@ ubinize ubirename ubirmvol ubirsvol +ubiscan ubiupdatevol volrefcnt mtdlib_test From patchwork Tue Nov 9 08:17:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frederic Germain X-Patchwork-Id: 1552777 X-Patchwork-Delegate: david.oberhollenzer@sigma-star.at Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=NP5GZ5bS; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=E3SfGNuF; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HpLVF0bRxz9sCD for ; Tue, 9 Nov 2021 19:19:01 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QypU1VO+ELWEAXE5zBU4Ml8s9xA8fmdM7qPPRHqrbxw=; b=NP5GZ5bSlzRORH yQZttf1+2YPILskSlEVE+2gOkHzss8DxfRRDsm5p8Y13ke9yIDQ/eVquQyp6570L+tkSa35GWh69H wq3Gd2VWHmUfoOvYkxZ08ANGkAEBs1WbTA01XN+B3hNjrousZAbbLJW/JyOodaW+ffUmXfSkzPRPW uKdqHyxzeOxMAqE1kL+US0WrIwN0ViHWTQHjSCx6vSM4lyzaHKSS0E6+ng8+4CSKDaeRqNyhvAAY0 Te/2UDNA8eXxo+2dDT9y6MvB32DP06/2gtGurxbZsbzBmbZe1Am7YmwsjKOsWXKd9ynn3/8/TSXPx wb6hgqgUcQoi1/dLRd9A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkMKv-000xQE-QS; Tue, 09 Nov 2021 08:18:33 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkMKe-000xN1-5W for linux-mtd@lists.infradead.org; Tue, 09 Nov 2021 08:18:17 +0000 Received: by mail-wr1-x432.google.com with SMTP id w29so19933592wra.12 for ; Tue, 09 Nov 2021 00:18:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pnkPG58aRSU2stN/sz2HOoqniIWG+VTIsOCOHEzxkKk=; b=E3SfGNuFCiZ9f1c8YU9jPw7yxrEcbp+n0Jx/U69b3lLLDtYDpLQymeXCEuhCqdsWA7 s4TrH3CSGuHFWvDL8TT/oAd2EcPdbRbXewA9mM+17HQX5VaqIeiGvNTTEBmK5Nfc5QeX y5DKucjg/YI6hRKP2ffGH/CN9zPlA5pL4M8pc4E8YldHV6OrEd2x3ZtvrnoWY9cslEsN o+N/HauzignQPJRa5sEo27lFBEMXqBuu87BUGBe74m+h4Kf/n4nNRf6ZAgih3tWTIg0v e8DgSoGm364moXmnlDTp4qowJjZN/f1qCaSy5DaM5QWp8mbmSB3qpEVXEsnPWGvDkx+g ewAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pnkPG58aRSU2stN/sz2HOoqniIWG+VTIsOCOHEzxkKk=; b=wKXl1g4k4IC6XkeCYhnvCLXpqACh4uTqctbl2uwHnY1GHMCAXnskz3LPBZ93MST4/f THDKHy4M1iLt5dzrscDh2YB5jhdYpQq3GNr1WUpttPHrkaodm2cb+wRIspg7RYKnT58q G/u9Aip9NUxP1tvoIJRIQhnamq0MR53VOFwgxqko7hirgn98wR3ZHdSk4WChwnrm+bpQ EVcGSBRpb6OGz+AC+kEfj2Hl4j0nzc39mOh3usBTdf+bjjZj5AdYlXVoeXUTvtm0QaDa GhyGuJzuhR2So9tKxGgQj9bAz5nHcy+sYPQs9wjoyL2/nFJDZmaKb7NH9gAj21/BEoVc 8OOg== X-Gm-Message-State: AOAM532LI4ywGPoHJaqIcTRPxA3Kx8//jeeb3r13nEfXw5pFthx0p+sO OGpx7xgtUI7+HgnvLvFOPPlawSZiVaYfC1hQ X-Google-Smtp-Source: ABdhPJxRiGxA54ILqlQvetDaXHpTnS3kj7sz+xXvfNoHzThLWzlyD37dk0GddUeNrf4Al6BLP2mpqQ== X-Received: by 2002:a5d:6d49:: with SMTP id k9mr6579039wri.352.1636445894650; Tue, 09 Nov 2021 00:18:14 -0800 (PST) Received: from thor.lan ([213.205.241.131]) by smtp.gmail.com with ESMTPSA id n184sm1714028wme.2.2021.11.09.00.18.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Nov 2021 00:18:14 -0800 (PST) From: Frederic Germain To: linux-mtd@lists.infradead.org Cc: Frederic Germain Subject: [PATCH 2/4] Fix warning about unaligned pointer in jffs2reader Date: Tue, 9 Nov 2021 08:17:49 +0000 Message-Id: <20211109081751.480718-3-frederic.germain@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211109081751.480718-1-frederic.germain@gmail.com> References: <20211109081751.480718-1-frederic.germain@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211109_001816_233066_25A85EAD X-CRM114-Status: GOOD ( 11.37 ) X-Spam-Score: -0.2 (/) X-Spam-Report: =?unknown-8bit?q?Spam_detection_software=2C_running_on_the_sy?= =?unknown-8bit?q?stem_=22bombadil=2Einfradead=2Eorg=22=2C?= =?unknown-8bit?q?_has_NOT_identified_this_incoming_email_as_spam=2E__The_ori?= =?unknown-8bit?q?ginal?= =?unknown-8bit?q?_message_has_been_attached_to_this_so_you_can_view_it_or_la?= =?unknown-8bit?q?bel?= =?unknown-8bit?q?_similar_future_email=2E__If_you_have_any_questions=2C_see?= =?unknown-8bit?q?_the_administrator_of_that_system_for_details=2E?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_Content_preview=3A__gcc_9=2E3=2E0-17ubuntu1=7E20=2E04_warn?= =?unknown-8bit?q?ing_on_time=5Ft_ctime_value_is?= =?unknown-8bit?q?_=3A_Fix_taking_address_of_packed_member_of_=E2=80=98struct?= =?unknown-8bit?q?_jffs2=5Fraw=5Finode=E2=80=99_may?= =?unknown-8bit?q?_result_in_an_unaligned_pointer_value_=5B-Waddress-of-packe?= =?unknown-8bit?q?d-member=5D=2E_?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_Content_analysis_details=3A___=28-0=2E2_points=2C_5=2E0_re?= =?unknown-8bit?q?quired=29?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_pts_rule_name______________description?= =?unknown-8bit?q?_----_----------------------_------------------------------?= =?unknown-8bit?q?--------------------?= =?unknown-8bit?q?_-0=2E0_RCVD=5FIN=5FDNSWL=5FNONE_____RBL=3A_Sender_listed_a?= =?unknown-8bit?q?t_https=3A//www=2Ednswl=2Eorg/=2C?= =?unknown-8bit?q?_no_trust?= =?unknown-8bit?b?IFsyYTAwOjE0NTA6NDg2NDoyMDowOjA6MDo0MzIgbGlzdGVkIGluXQ==?= =?unknown-8bit?b?IFtsaXN0LmRuc3dsLm9yZ10=?= =?unknown-8bit?q?_-0=2E0_SPF=5FPASS_______________SPF=3A_sender_matches_SPF_?= =?unknown-8bit?q?record?= =?unknown-8bit?q?_0=2E0_SPF=5FHELO=5FNONE__________SPF=3A_HELO_does_not_publ?= =?unknown-8bit?q?ish_an_SPF_Record?= =?unknown-8bit?q?_0=2E0_FREEMAIL=5FFROM__________Sender_email_is_commonly_ab?= =?unknown-8bit?q?used_enduser_mail?= =?unknown-8bit?q?_provider?= =?unknown-8bit?q?_=5Bfrederic=2Egermain=5Bat=5Dgmail=2Ecom=5D?= =?unknown-8bit?q?_-0=2E1_DKIM=5FVALID=5FAU__________Message_has_a_valid_DKIM?= =?unknown-8bit?q?_or_DK_signature_from?= =?unknown-8bit?q?_author=27s_domain?= =?unknown-8bit?q?_-0=2E1_DKIM=5FVALID_____________Message_has_at_least_one_v?= =?unknown-8bit?q?alid_DKIM_or_DK_signature?= =?unknown-8bit?q?_0=2E1_DKIM=5FSIGNED____________Message_has_a_DKIM_or_DK_si?= =?unknown-8bit?q?gnature=2C_not_necessarily?= =?unknown-8bit?q?_valid?= =?unknown-8bit?q?_-0=2E1_DKIM=5FVALID=5FEF__________Message_has_a_valid_DKIM?= =?unknown-8bit?q?_or_DK_signature_from?= =?unknown-8bit?q?_envelope-from_domain?= X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org gcc 9.3.0-17ubuntu1~20.04 warning on time_t ctime value is : Fix taking address of packed member of ‘struct jffs2_raw_inode’ may result in an unaligned pointer value [-Waddress-of-packed-member]. Signed-off-by: Frederic Germain --- jffsX-utils/jffs2reader.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jffsX-utils/jffs2reader.c b/jffsX-utils/jffs2reader.c index 083500e..33c5577 100644 --- a/jffsX-utils/jffs2reader.c +++ b/jffsX-utils/jffs2reader.c @@ -336,8 +336,9 @@ static void printdir(char *o, size_t size, struct dir *d, const char *path, d = d->next; continue; } - - filetime = ctime((const time_t *) &(ri->ctime)); + time_t _ctime; + memcpy(&_ctime, &(ri->ctime), sizeof(time_t)); + filetime = ctime(&_ctime); age = time(NULL) - je32_to_cpu(ri->ctime); mode.v32 = ri->mode.m; printf("%s %-4d %-8d %-8d ", mode_string(je32_to_cpu(mode)), From patchwork Tue Nov 9 08:17:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederic Germain X-Patchwork-Id: 1552778 X-Patchwork-Delegate: david.oberhollenzer@sigma-star.at Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=0BL38dz3; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=dKlhV5Rr; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HpLVc6l3Kz9sCD for ; Tue, 9 Nov 2021 19:19:20 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dv+wqim01VZUmIu9Y0BgE9Cwvx/DKtKggGjkKfUrMeA=; b=0BL38dz3v4PDnX SNSStSbnh3pS1BSjx3jdcMII6PmNARLh14WNysx/yJjF8OwQ+eBcrunij1nkkEuInCaGAanBObPFa uqSZGFO9up1p+HrPTnFXWThhmRapjrr56yTjsZ1M8/BvpMoAKDj5gFwISkzFNQ4EenEpVHaRYhYUe LciwGTaS7D+1STiQQ2SQXkGWauB4x168827tgjR1olzyUngn0evFfz2I1BJrVnvIk1xf4gv2Xlyjx M6X6QO/4HjTHMGGV8pKxFkFDMgwclErjZ+MOpsF/iym7WftznGLrKSOpXca/4uat4j15mFuBumOPB 3RFDNthfripZAXrx/P3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkMLB-000xUE-SQ; Tue, 09 Nov 2021 08:18:49 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkMKe-000xNH-Ip for linux-mtd@lists.infradead.org; Tue, 09 Nov 2021 08:18:18 +0000 Received: by mail-wr1-x432.google.com with SMTP id b12so31501244wrh.4 for ; Tue, 09 Nov 2021 00:18:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+Wo+xvI0btcU5woTehpGfHeJePWgerA+oyo3xcTWT9o=; b=dKlhV5RrJe6whF4CZPKxbCpjVXQu5xXK0zxyUvZMrquumbY8uhjPpRlpWA0JGymfaC nnikCc5kQ+FpvUG9xB+h8nYBHgtDe/ze6pFEzjYNUW5Q6QUHL6Tmv36mb0V5bL91Tujb baRoz8pN0wGo1CdfsE7ctCSrzz14j0nm4K7n2QC2B4FHrUGQeUHBGgHthitnrdMnTvil ITBPIXaDjAhTO0cGbdtNTinUXVueihjixTJTEQ3h69Sv/v80SJiEl+0eTrWydidYe1QT n3a6sh1PmszZY4EXAJp9fdXEcr8T+wZte1XkCitTMpunTxrGJXHpzA2EEl/oNDNUVIcL 7Gtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+Wo+xvI0btcU5woTehpGfHeJePWgerA+oyo3xcTWT9o=; b=hUQk5kTbBcRd390/GMC36SBCEgN+wzgoOY/prFZ4R4KwOAw2wmRTCLfR+tcPeWLtV8 BihEeXM7NfauWbcMxu0W8HyvB5trZyelfeNfbcgGaK779qKbZTZCsq7ankJo1pm8NZYY xP6MqododB74F1gu9V7tybmy/ZqIngcDZ2y7C4lJbiNKRZ792emExsH4qVkmzrRNelrO Xst2LnKwGLZKoUra0kNn7elPZyLWFOO/VXwgIFP5mmlixKdeWnFGGIibEBOVC776svpY xAq5L0xjARAKrklG9RHM/kqosz8nKuP0W8KyISNu+ZfxPUAUj6BcFFYBKrLTgisS5MQW JSzg== X-Gm-Message-State: AOAM532UX9PTcRv/nQcuG1CS24vgu3Xx6Adsw1izJ4NpTwSNj8m/WDbd VC30zNjQI4OyKHfuaGzXBeXPOgpBBoLsgekU X-Google-Smtp-Source: ABdhPJyL7bNl+YaU5plhuVeb5tIRV03xGYKj0eE276skPLkQjrOC+ZbMTLYDHqv3cAEvBRueCsFToA== X-Received: by 2002:a5d:59a2:: with SMTP id p2mr7198847wrr.252.1636445895311; Tue, 09 Nov 2021 00:18:15 -0800 (PST) Received: from thor.lan ([213.205.241.131]) by smtp.gmail.com with ESMTPSA id n184sm1714028wme.2.2021.11.09.00.18.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Nov 2021 00:18:15 -0800 (PST) From: Frederic Germain To: linux-mtd@lists.infradead.org Cc: Frederic Germain Subject: [PATCH 3/4] jffsX-utils: add lzma support on jffs2reader Date: Tue, 9 Nov 2021 08:17:50 +0000 Message-Id: <20211109081751.480718-4-frederic.germain@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211109081751.480718-1-frederic.germain@gmail.com> References: <20211109081751.480718-1-frederic.germain@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211109_001816_648664_36D8FF29 X-CRM114-Status: GOOD ( 17.25 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Signed-off-by: Frederic Germain --- Makefile.am | 4 ++++ configure.ac | 24 +++++++++++++++++++++ include/linux/jffs2.h | 2 ++ include/mtd/jffs2-user.h | 1 + jffsX-utils/Makemodule.am | 2 +- jffsX-ut [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:432 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [frederic.germain[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Frederic Germain --- Makefile.am | 4 ++++ configure.ac | 24 +++++++++++++++++++++ include/linux/jffs2.h | 2 ++ include/mtd/jffs2-user.h | 1 + jffsX-utils/Makemodule.am | 2 +- jffsX-utils/jffs2reader.c | 45 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 77 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 9da38af..02a3073 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,6 +11,10 @@ if WITHOUT_LZO AM_CPPFLAGS += -DWITHOUT_LZO endif +if WITHOUT_LZMA +AM_CPPFLAGS += -DWITHOUT_LZMA +endif + if WITHOUT_ZSTD AM_CPPFLAGS += -DWITHOUT_ZSTD endif diff --git a/configure.ac b/configure.ac index f47100f..e5035c0 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,7 @@ need_clock_gettime="no" need_pthread="no" need_uuid="no" need_zlib="no" +need_lzma="" need_lzo="no" need_zstd="no" need_xattr="no" @@ -158,6 +159,14 @@ AC_ARG_WITH([lzo], *) AC_MSG_ERROR([bad value ${withval} for --without-lzo]) ;; esac]) +AC_ARG_WITH([lzma], + [AS_HELP_STRING([--without-lzma], [Disable support for LZMA compression])], + [case "${withval}" in + yes) need_lzma="yes";; + no) need_lzma="no" ;; + *) AC_MSG_ERROR([bad value ${withval} for --without-lzma]) ;; + esac]) + AC_ARG_WITH([zstd], [AS_HELP_STRING([--without-zstd], [Disable support for ZSTD compression])], [case "${withval}" in @@ -190,6 +199,7 @@ clock_gettime_missing="no" pthread_missing="no" uuid_missing="no" zlib_missing="no" +lzma_missing="no" lzo_missing="no" zstd_missing="no" xattr_missing="no" @@ -219,6 +229,14 @@ if test "x$need_pthread" = "xyes"; then AX_PTHREAD([], [pthread_missing="yes"]) fi +if test "x$need_lzma" != "xno"; then + AC_ARG_VAR([LZMA_CFLAGS], [C compiler flags for lzma]) + AC_ARG_VAR([LZMA_LIBS], [linker flags for lzma]) + AC_CHECK_LIB([lzma], [lzma_alone_decoder], [LZMA_LIBS="-llzma"], + [lzma_missing="yes"] + ) +fi + if test "x$need_lzo" = "xyes"; then AC_ARG_VAR([LZO_CFLAGS], [C compiler flags for lzo]) AC_ARG_VAR([LZO_LIBS], [linker flags for lzo]) @@ -287,6 +305,11 @@ if test "x$zlib_missing" = "xyes"; then dep_missing="yes" fi +if test "x$need_lzma" = "xyes" -a "x$lzma_missing" = "xyes"; then + AC_MSG_WARN([cannot find LZMA library required by options]) + dep_missing="yes" +fi + if test "x$lzo_missing" = "xyes"; then AC_MSG_WARN([cannot find LZO library required for mkfs programs]) AC_MSG_NOTICE([mtd-utils can optionally be built without mkfs.ubifs]) @@ -339,6 +362,7 @@ fi ##### generate output ##### AM_CONDITIONAL([WITHOUT_LZO], [test "x$need_lzo" != "xyes"]) +AM_CONDITIONAL([WITHOUT_LZMA], [test "x$need_lzma" == "xno" -o "x$missing_lzma" == "xyes" ]) AM_CONDITIONAL([WITHOUT_ZSTD], [test "x$need_zstd" != "xyes"]) AM_CONDITIONAL([WITHOUT_XATTR], [test "x$need_xattr" != "xyes"]) AM_CONDITIONAL([WITH_SELINUX], [test "x$need_selinux" == "xyes"]) diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h index 7306f86..47abf62 100644 --- a/include/linux/jffs2.h +++ b/include/linux/jffs2.h @@ -47,6 +47,8 @@ #define JFFS2_COMPR_DYNRUBIN 0x05 #define JFFS2_COMPR_ZLIB 0x06 #define JFFS2_COMPR_LZO 0x07 +// diff --git a/target/linux/generic/patches-4.1/530-jffs2_make_lzma_available.patch b/target/linux/generic/patches-4.1/530-jffs2_make_lzma_available.patch +#define JFFS2_COMPR_LZMA 0x08 // https://git.openwrt.org/project/ubus.git;git://git.openwrt.org/project/ubox.git?p=openwrt/openwrt.git;a=commitdiff;h=a0c49ef46f7caf5eb02c635d446218201008ecff;hp=518ab154e059c9f39684f8c78159c9caf333716b /* Compatibility flags. */ #define JFFS2_COMPAT_MASK 0xc000 /* What do to if an unknown nodetype is found */ #define JFFS2_NODE_ACCURATE 0x2000 diff --git a/include/mtd/jffs2-user.h b/include/mtd/jffs2-user.h index bc5d99a..7228b5f 100644 --- a/include/mtd/jffs2-user.h +++ b/include/mtd/jffs2-user.h @@ -36,6 +36,7 @@ extern int target_endian; #define le32_to_cpu(x) (__BYTE_ORDER==__LITTLE_ENDIAN ? (x) : bswap_32(x)) #define cpu_to_le16(x) (__BYTE_ORDER==__LITTLE_ENDIAN ? (x) : bswap_16(x)) #define cpu_to_le32(x) (__BYTE_ORDER==__LITTLE_ENDIAN ? (x) : bswap_32(x)) +#define cpu_to_le64(x) (__BYTE_ORDER==__LITTLE_ENDIAN ? (x) : bswap_64(x)) /* XATTR/POSIX-ACL related definition */ /* Namespaces copied from xattr.h and posix_acl_xattr.h */ diff --git a/jffsX-utils/Makemodule.am b/jffsX-utils/Makemodule.am index 96389f6..0c93c18 100644 --- a/jffsX-utils/Makemodule.am +++ b/jffsX-utils/Makemodule.am @@ -16,7 +16,7 @@ mkfs_jffs2_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS) mkfs_jffs2_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) jffs2reader_SOURCES = jffsX-utils/jffs2reader.c include/mtd/jffs2-user.h -jffs2reader_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS) +jffs2reader_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS) $(LZMA_LIBS) jffs2reader_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) jffs2dump_SOURCES = jffsX-utils/jffs2dump.c include/mtd/jffs2-user.h diff --git a/jffsX-utils/jffs2reader.c b/jffsX-utils/jffs2reader.c index 33c5577..2aa2137 100644 --- a/jffsX-utils/jffs2reader.c +++ b/jffsX-utils/jffs2reader.c @@ -76,6 +76,9 @@ BUGS: #include #include #include +#ifndef WITHOUT_LZMA +#include +#endif #include "mtd/jffs2-user.h" #include "common.h" @@ -147,6 +150,48 @@ static void putblock(char *b, size_t bsize, size_t * rsize, bzero(b + je32_to_cpu(n->offset), dlen); break; +#ifndef WITHOUT_LZMA + case JFFS2_COMPR_LZMA: { + // https://sourceforge.net/p/lzmautils/discussion/708858/thread/d02ebb9386/ + lzma_stream strm = LZMA_STREAM_INIT; + size_t csize = je32_to_cpu(n->csize); + Bytef *in = (Bytef *) ((char *) n) + sizeof(struct jffs2_raw_inode); + Bytef *out = (Bytef *) b + je32_to_cpu(n->offset); + Bytef *compressed_with_header = xmalloc(13 + csize); + + // LZMA properties byte (lc/lp/pb). typical 3/0/2 is 0x5D. + // But here works with 0/0/0 + compressed_with_header[0] = 0; + + // dictionary size as bytes[4], using value from preset 1 + lzma_options_lzma opt_lzma; + if (lzma_lzma_preset(&opt_lzma, 1)) { + fprintf(stderr, "preset failed\n"); + exit(1); + } + uint32_t dict_size_le = cpu_to_le32(opt_lzma.dict_size); + memcpy(&compressed_with_header[1], &dict_size_le, sizeof(dict_size_le)); + + // uncompressed size as unsigned 60-bit little endian integer + uint64_t uncompressed_size_le = cpu_to_le64(dlen); + memcpy(&compressed_with_header[5], &uncompressed_size_le, sizeof(uncompressed_size_le)); + + memcpy(&compressed_with_header[13], in, csize); + lzma_ret ret = lzma_alone_decoder(&strm, UINT64_MAX); + // lzma_ret ret = lzma_alone_decoder(&strm, hardware_memlimit_get(MODE_DECOMPRESS)); + strm.next_in = compressed_with_header; + strm.avail_in = 13 + csize; + strm.next_out = out; + strm.avail_out = dlen; + ret = lzma_code(&strm, LZMA_RUN); + if (ret == LZMA_OK) { + printf("lzma_code ret:%d in:%ld\n", ret, strm.total_in); + } + free(compressed_with_header); + } + break; +#endif + /* [DYN]RUBIN support required! */ default: From patchwork Tue Nov 9 08:17:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederic Germain X-Patchwork-Id: 1552779 X-Patchwork-Delegate: david.oberhollenzer@sigma-star.at Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Jag2stYw; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=ZADEgV5d; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HpLVx4kcYz9sCD for ; Tue, 9 Nov 2021 19:19:37 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hImn+DXGxnGWHLGkUnu2crTfScJ3RafImWOcvbdSIuk=; b=Jag2stYwWoNqYA 1TwPNZew2r8+5L7IcANV0dkE4HII122GJeR6kzdArd/3cf5fT7tbXR/Va60ARw0lExfOMkOiqb+pb N5P1l/G2c5i9oNz/64IEiiSH6p+wZwyUoWevJmOKk6PTJJocfYyVhdymdgEI9RQfMr8JHqrg+a+w2 clXttqg31eo8/0yPq0dWQmOA2yD3dy5Nsz6JeWHlDwgOu1HlBI7DCwRKUMZlTGSLddAvgPnrxibvl Zvq0KP2exDwKlCUsH1h1AX6PVhmdmqpa8VXTZXPmIriXx3cgh/vQA2n0xM5MCqAXA5dQDg5/BLME7 XLgJqfpV1ZCSSXfNVK0w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkMLW-000xad-P4; Tue, 09 Nov 2021 08:19:11 +0000 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkMKf-000xNX-HJ for linux-mtd@lists.infradead.org; Tue, 09 Nov 2021 08:18:18 +0000 Received: by mail-wr1-x42a.google.com with SMTP id w29so19933681wra.12 for ; Tue, 09 Nov 2021 00:18:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Cfln5vAwk2QX8ubWwPgT9DGyoRwTf2Aw96icF5byAH8=; b=ZADEgV5dLgq4walolSISH8oS/G5mq99mwx2o6Gnxj1pxlVMjAsnOjzvWXhHDOD8nlY GhqzZNF8/I5zMzsFV8webpFyEh99wqc4N3Hg+JugNeAmiUPwBz4ceozDE/OMwd1U7ajw w2BBwiJhNZf//jKDyAGp+iimtl3VNS0CXAoj7MJ1Z7TFHEfIlQEEWcGRt4xBhOQlM45j pzdmZ4MTUk1qJcBAiqE5HlD9nT1Qap3XuippxZXwzyQnS253rd2rnWNiRnDJ1lF8lBBe XYFrbLAH/7SBCzcbrntYMYiYj2UkiX6bgMrd6cH3NZMlbjlWw9JV4gFuICyTuSyOZVxq pvsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cfln5vAwk2QX8ubWwPgT9DGyoRwTf2Aw96icF5byAH8=; b=5n/xFYQhx7F5pq00UvkrMR+ID09MvIBxZoNWDhT3Ye9p7FmuybuWFmonXLyGrnhmrz XihLuqCkkHJAoQhgB0PSZVookoxFbNS2LgzkaQ4JkpVmtKOLE3ky0kAhHK1G0pa8AyOX TDdxR6HQBmdNuJ1rGnL9nOiPONi9dNe54UBfGESfNIo4VJm9iEafI1AMHzHmQw+6y7cN ba4HSF5WjmQEY9bh/ieuINONZlhfSS8PT+xJb+JXapDKy4+XaUJZZkfus1DM07r6Gzs0 ZDvByh/OrfJ6hP4Dgf0zdrMTtYsn+D4ta+vcoDRxqRtXoj6IFANsRjtebXJzdqa+AyYF Xbpg== X-Gm-Message-State: AOAM531I8UpicFQklwo1FfSdu7ZzqREd7rLOfrHQs4KBWyATAIBFzlyw 8LvwhhC2+kpGCPHpPT0U41gg7GCsNL33a8WK X-Google-Smtp-Source: ABdhPJxDW0mqsCWZD9vbVD9A5b/kejvW3AWJl4aeUMk84ADsTHeySHJD9ujTqnvga8+zuuAlXk8qRg== X-Received: by 2002:a5d:47c7:: with SMTP id o7mr7200123wrc.204.1636445896028; Tue, 09 Nov 2021 00:18:16 -0800 (PST) Received: from thor.lan ([213.205.241.131]) by smtp.gmail.com with ESMTPSA id n184sm1714028wme.2.2021.11.09.00.18.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Nov 2021 00:18:15 -0800 (PST) From: Frederic Germain To: linux-mtd@lists.infradead.org Cc: Frederic Germain Subject: [PATCH 4/4] find_raw_inode returns latest version with data of inode Date: Tue, 9 Nov 2021 08:17:51 +0000 Message-Id: <20211109081751.480718-5-frederic.germain@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211109081751.480718-1-frederic.germain@gmail.com> References: <20211109081751.480718-1-frederic.germain@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211109_001817_637768_2B7D3336 X-CRM114-Status: GOOD ( 13.15 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Signed-off-by: Frederic Germain --- jffsX-utils/jffs2reader.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/jffsX-utils/jffs2reader.c b/jffsX-utils/jffs2reader.c index 2aa2137..c0c61cf 100644 --- a/jffsX-utils/jffs2reader.c +++ b/jffsX-utils/jffs2reader.c @@ -484,18 +484,19 @@ static struct jff [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:42a listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [frederic.germain[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Frederic Germain --- jffsX-utils/jffs2reader.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/jffsX-utils/jffs2reader.c b/jffsX-utils/jffs2reader.c index 2aa2137..c0c61cf 100644 --- a/jffsX-utils/jffs2reader.c +++ b/jffsX-utils/jffs2reader.c @@ -484,18 +484,19 @@ static struct jffs2_raw_inode *find_raw_inode(char *o, size_t size, if (n < e && je16_to_cpu(n->u.magic) == JFFS2_MAGIC_BITMASK) { if (je16_to_cpu(n->u.nodetype) == JFFS2_NODETYPE_INODE && - je32_to_cpu(n->i.ino) == ino && (v = je32_to_cpu(n->i.version)) > vcur) { + je32_to_cpu(n->i.ino) == ino && (v = je32_to_cpu(n->i.version)) > vcur && je32_to_cpu(n->i.csize)) { /* XXX crc check */ - if (vmaxt < v) + if (vmaxt < v) { vmaxt = v; - if (vmint > v) { - vmint = v; mp = n; } + if (vmint > v) { + vmint = v; + } - if (v == (vcur + 1)) - return (&(n->i)); +// if (v == (vcur + 1)) +// return (&(n->i)); } ADD_BYTES(n, ((je32_to_cpu(n->u.totlen) + 3) & ~3));