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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9E496C4321E for ; Sat, 26 Nov 2022 17:19:53 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 58F3A85261; Sat, 26 Nov 2022 18:18:36 +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="2mo8Sowe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0ADF685023; Sat, 26 Nov 2022 17:59:48 +0100 (CET) Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) (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 CBE9F85031 for ; Sat, 26 Nov 2022 17:59:45 +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-x42e.google.com with SMTP id z4so10834827wrr.3 for ; Sat, 26 Nov 2022 08:59:45 -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=EOsgrcLkWGcPEJRaybZWc4IwSN+jBbKTsZIPBU5o7PQ=; b=2mo8SoweTnopYJVr0k9wWqipKGihvdC76QpjPKIFPgSrTxmyLye2F2BqJlZPt9jgkZ va6iYJRi25GuZNi4UoytIcoOnXVPG7w69PddV47JjQg7kZQ3kL4Yjtf1b/LazWvLrDT8 UEyKpkP55vTqVAbM270cz0gySdj2zB2fNFayFsEF8Nk6m1P57Iuv5dBnjLHWYCX5Yak2 DGkbvFoYLOhGMO2SBvGzxR02Rfs78cQ/P6WzIRZwEbv691qvxv908GHoJDQ7Msmcx80C KSJq7YdacYMYfPD4TDqop+4gxHsg0UIisq0LbLgfHCeaafMXNaaoXZPjyLg6JyfH49xk Wr+Q== 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=EOsgrcLkWGcPEJRaybZWc4IwSN+jBbKTsZIPBU5o7PQ=; b=UqeXK6pl3SXGk7FAbn3U6SzR6OgHj9EHqRcxPyGB4kNuSTSDiSZ6oxr+nwVwzZ6wJZ omTj3IIoLNdS7EmeZw2zEcT6UWY8fUxQj6i02tV8dcvGMRsWqJxSnbEW1J7ZkLUzkSa9 1iPJ1UjEUc0uQNeNaFi6acCdPPQNMF1Qk06AZl1BZdnrAum+pcCmC2xX6ONQycP++WT4 73sNarkY7pi4PdH0geqAlvlanajm+Z9KcoivMFJjWPrfZ/GVHcTxUAfK0rv+bLqxfRS/ cHLYZZemMpaGdriELubtvkLwtZa6kiG4qL/GZ25pohzTfJTjrEJOrxSHPRuXqEZTDlIS cxyA== X-Gm-Message-State: ANoB5pmMEzGJXwQhgfYWAYrpoYieBBu4fpEuTv+P/9hVo0YjjWtrRza7 3Y6oooujL5huwLjJ2mR9pzj3cA== X-Google-Smtp-Source: AA0mqf4XX3RvWLhmXCaLERMW65S+UDbdOwOT3aGtv1ujCE1WZ+UKFvqu2xJIReoyJ8ev6/ydPKlz1A== X-Received: by 2002:adf:ee4d:0:b0:236:8ead:3da5 with SMTP id w13-20020adfee4d000000b002368ead3da5mr27049169wro.391.1669481985365; Sat, 26 Nov 2022 08:59:45 -0800 (PST) Received: from safae.baylibre.local ([2a04:cec0:11b5:4031:7588:eb2c:a5c2:aa6d]) by smtp.gmail.com with ESMTPSA id c15-20020adfe70f000000b00241e8d00b79sm7462408wrm.54.2022.11.26.08.59.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Nov 2022 08:59:45 -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 08/17] android: boot: content print is not supported for v3, v4 header version Date: Sat, 26 Nov 2022 17:59:22 +0100 Message-Id: <20221126165931.197607-9-souajih@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221126165931.197607-1-souajih@baylibre.com> References: <20221126165931.197607-1-souajih@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Sat, 26 Nov 2022 18:18:14 +0100 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 --- 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 d0cb8615c28c..d6476904f35e 100644 --- a/boot/image-android.c +++ b/boot/image-android.c @@ -475,6 +475,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_v1_v2 *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; @@ -507,7 +511,7 @@ void android_print_contents(const struct andr_boot_img_hdr_v0_v1_v2 *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); } -- 2.25.1