From patchwork Wed Mar 16 19:35:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgQ2FycmV0ZXJv?= X-Patchwork-Id: 1606290 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=zougloub.eu header.i=@zougloub.eu header.a=rsa-sha256 header.s=zougloub.eu header.b=1vhvqfKE; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KJgVw3BfWz9sCD for ; Thu, 17 Mar 2022 06:36:07 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EBE1D83ADA; Wed, 16 Mar 2022 20:36:01 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=zougloub.eu Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=zougloub.eu header.i=@zougloub.eu header.b="1vhvqfKE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9E6FA83ADC; Wed, 16 Mar 2022 20:35:59 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from zougloub.eu (zougloub.eu [69.70.16.42]) by phobos.denx.de (Postfix) with ESMTP id DA36682065 for ; Wed, 16 Mar 2022 20:35:55 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=zougloub.eu Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=cJ@zougloub.eu Received: from localhost (exmakhina.com [69.70.16.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by zougloub.eu (Postfix) with ESMTPSA id CB1B91A10DDA; Wed, 16 Mar 2022 15:35:54 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=zougloub.eu; s=zougloub.eu; t=1647459354; bh=x/FEWvwKyqQbOM/wEev6trQqdVFrP7wyzGBwTlUa0UM=; h=From:To:Cc:Subject:Date; b=1vhvqfKERpqBaGwi753ur+77PzTPfxcHbfW+00OtxDpahSLkNlHFlGoWrQKETvgUm gXXUkD5hRq+DFo/2zmvM8wcY2ePlR+i8qvi1e6VTDjKSDJ0CFB9Z8Gi+KVfIky7ICb T90Z3QYqihp3u44HKeno4LaqeZWieoUrv1Pc1Od8= From: =?utf-8?b?SsOpcsO0bWUgQ2FycmV0ZXJv?= To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , =?utf-8?b?SsOpcsO0bWUgQ2FycmV0ZXJv?= Subject: [PATCH v2] boot: image: fixup zstd decompression buffer initialization typo Date: Wed, 16 Mar 2022 15:35:36 -0400 Message-Id: <20220316193536.3992652-1-cJ-uboot@zougloub.eu> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean The code was mistakenly initializing the input buffer twice. Tested to be working on BeagleBone by adjusting CONFIG_SYS_BOOTM_LEN to 64MiB (probably works with less) and preparing uImage with: cat arch/arm/boot/Image \ | zstd --ultra -22 --zstd=windowLog=22 \ > linux.bin.zst mkimage -A arm -T kernel uImage -C zstd -d linux.bin.zst \ -a 0x80008000 -e 0x80008000 Without the windowLog restriction, bootm fails with a zstd decompression error 7 (window too large), which I haven't troubleshooted. There should be a bit more documentation on the feature... Reviewed-by: Simon Glass Fixes: 458b30af66c image: Update image_decomp() to avoid ifdefs --- boot/image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot/image.c b/boot/image.c index 07fa2d3160..121df0c838 100644 --- a/boot/image.c +++ b/boot/image.c @@ -500,7 +500,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type, struct abuf in, out; abuf_init_set(&in, image_buf, image_len); - abuf_init_set(&in, load_buf, unc_len); + abuf_init_set(&out, load_buf, unc_len); ret = zstd_decompress(&in, &out); if (ret >= 0) { image_len = ret;