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 6A104C636CD for ; Sun, 5 Feb 2023 23:51:58 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6DBBF85B6F; Mon, 6 Feb 2023 00:51:07 +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="yzXgK6DQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 047BC859E9; Mon, 6 Feb 2023 00:50:44 +0100 (CET) Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (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 838AB85B2C for ; Mon, 6 Feb 2023 00:50: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=souajih@baylibre.com Received: by mail-wr1-x42c.google.com with SMTP id j25so5404933wrc.4 for ; Sun, 05 Feb 2023 15:50:36 -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=piQhG3B2CCjLsilt5Ggxyoj0q78OaY9KDuoEZ8GWmZI=; b=yzXgK6DQcoKlv35AEQNSao5VIvrNYbmcKvF3YruMyEwmW67+ZU+LNi87wZTkKg3ydy xz5oXT0nhqYl5iTEVzb6VW4a5EGaP/XFG1MjQJ63M3BcE5x9LgqyAVcipbZr1MzeIQl/ /5VLuUUojlt0cXbvbqm8Mx1x3awvvjkdTFV94UmC5viRoLern9a2GI12UAWpW16h90Hd xjOduZmIk77cFL3+t8iycs2BCgW/tMsslBFY8x3w95NKYE6iaNXDM5ATelOYHAOqCw29 wQYiIlU33DwInPr/1XlhRBSkIKML5fGh6b3sm6xHHGErJn+L+vqv5x3hsKclLnteLPC5 3gOA== 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=piQhG3B2CCjLsilt5Ggxyoj0q78OaY9KDuoEZ8GWmZI=; b=IE24kOgrk0LUbH7DDcVfaHmeCpJHFfq10PiFxEHMJJse02Vb1DQTa304mQa/BHu0M8 RrzQjWc/fyMLMj70m+zje+cOc2TSC7Gog+JZKrjrsO8LP6Yc22HOoOhegHp6owSUpok8 bYXh/hE5laEHxWCvBNZ6kcOsBJaysbakA3vrw+9euk3owSHIV1qgTKXbrYZEjj3m7E6v MZcyeZlhAsyUxWg7ykAHSwYxu5Qm2Yp4/tOR4WmhB1sm5y/cPqgELMeiBBDcogJQCAGM NwCAdkqR//KahIeXZPxxjCDlu9fEdnZmNlgFZpKTXQVgjq34qtG6MtS+Z1v+KekNRqH1 M7xA== X-Gm-Message-State: AO0yUKXIWJrBwPOthDJUK+Hmu5rhkBmPgqCN4bHMeM+UJ6o6edwNgx/V UppZY5P0rRglyVRN7LxtVQdEMg== X-Google-Smtp-Source: AK7set+j+XsC4jK3IA93zdiWrJSqfped9jOnwHtG9haOeF76I+xvzWfvsRLqkOzjcri85nGnwF3OAw== X-Received: by 2002:adf:cc87:0:b0:2c3:ddbe:d7b2 with SMTP id p7-20020adfcc87000000b002c3ddbed7b2mr5628825wrj.62.1675641035752; Sun, 05 Feb 2023 15:50:35 -0800 (PST) Received: from safae-ThinkPad-T480.. ([2a04:cec0:11ad:6643:93a:a991:f152:4df7]) by smtp.gmail.com with ESMTPSA id w2-20020a5d6802000000b002bfb1de74absm7430196wru.114.2023.02.05.15.50.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Feb 2023 15:50:35 -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 v3 07/19] android: boot: content print is not supported for v3, v4 header version Date: Mon, 6 Feb 2023 00:50:09 +0100 Message-Id: <20230205235021.355410-8-souajih@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230205235021.355410-1-souajih@baylibre.com> References: <20230205235021.355410-1-souajih@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 15a735e230..31a5d30162 100644 --- a/boot/image-android.c +++ b/boot/image-android.c @@ -477,6 +477,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; @@ -509,7 +513,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); } -- 2.34.1