From patchwork Thu Jan 26 16:04:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Safae Ouajih X-Patchwork-Id: 1732368 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=2R0WohgG; dkim-atps=neutral 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 ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P2lxp5rMkz23h7 for ; Fri, 27 Jan 2023 03:08:46 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7EA58856E8; Thu, 26 Jan 2023 17:08:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.b="2R0WohgG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 62F4485711; Thu, 26 Jan 2023 17:05:26 +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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 74D49856E8 for ; Thu, 26 Jan 2023 17:05:13 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=souajih@baylibre.com Received: by mail-wr1-x433.google.com with SMTP id q10so2267602wrm.4 for ; Thu, 26 Jan 2023 08:05:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=B6UrAoLMAeDMNrCr2JS07SzEBmriKe7yge59nPKk1YA=; b=2R0WohgGJPQ+Aa60Tn8BrHmc+kyVOq8xnXWXeokkFyUz5vbh7NECE+fOXMhZCT0b4y d34QdobM7t862UL8p9IPhVF0HY8oVJ6r6cUaj21JhSesaXdaNViFwCwLct2zMsPTMVnr 7xSBWcn/4AgWDIZlOAPl9RWvqsKqT5vzrdO/sniaHpJyhbpP00ChlOMLf5uh6DLkrRLA ibjANSOA5VmZfpzp3Dvt/TYLJvtz2aV8CvV7dOPQuQBuF5y6ht3KVDuKdQ9sy4KyDA99 c5KjEldhu3/qKWAA7AnUL9rSEoCPLb9JhDck5DjGfb4NzVxfBBT4XIVLfkkha2USmIly iTdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B6UrAoLMAeDMNrCr2JS07SzEBmriKe7yge59nPKk1YA=; b=QR6bBYi2UtAO04o3y/2DJwDi7NkflDvkQyP0ZJe0S2elzU6k3uy7fKc4xrK7FJN7SA QlIXxKNHG8sCTLFhWLwuGthv3f4bNs5aN37XEWI7F2Qnw/XFo15mCWz+7pD2iLQXL27Z 0Dj1w+Cp0bV0fkDohgdRqJN4cjFqCI5a31kqCcTfEc+SRgFP/LIhh90qe9LCILH3KbNP f2bE9KyspKpynVSyXqreNAmvIK7vmOFysNSnIlZdqkKI0403j6SzA2PY3Z9cYGiNrnuT Dg68kumwKDH2p2xe0NcXHDtz0+7C/tRiIeOu8C0sJ9gF3wadXQUwzxjzijNQhbk2tocE Qtdw== X-Gm-Message-State: AO0yUKWW7idCWp/CSsHTeRK4Fp+lAH3qE/N+YLaV9vUFmCYcjTHoh+Ma Kwv1YtVKVQIOh3oYCJ+m3ma5u/K/elGrYqe1 X-Google-Smtp-Source: AK7set/94sozoElD1OV3BCfX/HCbOgWdkG8gP3Mx1XQd9bSljRgdF4VH3WN2/6KEuIfABuPPqhAX8Q== X-Received: by 2002:a5d:498a:0:b0:2bf:ae3c:e963 with SMTP id r10-20020a5d498a000000b002bfae3ce963mr10027099wrq.9.1674749113140; Thu, 26 Jan 2023 08:05:13 -0800 (PST) Received: from localhost.localdomain (lfbn-nic-1-295-18.w90-116.abo.wanadoo.fr. [90.116.132.18]) by smtp.gmail.com with ESMTPSA id o1-20020adfcf01000000b002bfb6b9f55bsm1721235wrj.16.2023.01.26.08.05.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 08:05:12 -0800 (PST) From: Safae Ouajih To: sjg@chromium.org Cc: u-boot@lists.denx.de, sean.anderson@seco.com, r.stratiienko@gmail.com, mkorpershoek@baylibre.com, glaroque@baylibre.com, khilman@baylibre.com Subject: [PATCH v2 07/17] android: boot: content print is not supported for v3, v4 header version Date: Thu, 26 Jan 2023 17:04:56 +0100 Message-Id: <20230126160506.1026643-8-souajih@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230126160506.1026643-1-souajih@baylibre.com> References: <20230126160506.1026643-1-souajih@baylibre.com> 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.6 at phobos.denx.de X-Virus-Status: Clean Content print is not supported for version 3 and 4 of boot image header. Thus, only print that content when v2 is used. Update android_print_contents() to print an error message when trying to print boot image header version 3 or 4 content. Signed-off-by: Safae Ouajih Reviewed-by: Simon Glass Reviewed-by: Mattijs Korpershoek --- boot/image-android.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/boot/image-android.c b/boot/image-android.c index 9dab09a69a..a6e7a7abb0 100644 --- a/boot/image-android.c +++ b/boot/image-android.c @@ -481,6 +481,10 @@ bool android_image_get_dtb_by_index(ulong hdr_addr, u32 index, ulong *addr, */ void android_print_contents(const struct andr_boot_img_hdr_v0 *hdr) { + if (hdr->header_version >= 3) { + printf("Content print is not supported for boot image header version > 2"); + return; + } const char * const p = IMAGE_INDENT_STRING; /* os_version = ver << 11 | lvl */ u32 os_ver = hdr->os_version >> 11; @@ -513,7 +517,7 @@ void android_print_contents(const struct andr_boot_img_hdr_v0 *hdr) hdr->header_size); } - if (hdr->header_version >= 2) { + if (hdr->header_version == 2) { printf("%sdtb size: %x\n", p, hdr->dtb_size); printf("%sdtb addr: %llx\n", p, hdr->dtb_addr); }