From patchwork Mon Jun 12 08:09:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Miguel Silva X-Patchwork-Id: 691622 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d91:0:0:0:0:0 with SMTP id b17csp16726wru; Mon, 12 Jun 2023 01:13:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4AAFWwSOLQgHO36jHpqeD8BzZCqOixd6pO+a2Nd8Qia49kbQmWxXwvAuC09q42ya38HwZM X-Received: by 2002:a05:6a00:1884:b0:64d:40e0:5580 with SMTP id x4-20020a056a00188400b0064d40e05580mr11607330pfh.3.1686557634495; Mon, 12 Jun 2023 01:13:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686557634; cv=none; d=google.com; s=arc-20160816; b=DAyq3JBBJ0GplaflgOm2IpqwMiH531WwFPS2b7GCjlGphjxCPY/qw47cMoGggKlBat rl4y/cmzeyLdPyFJqBDiA437OlvlJOPN84WeifCc9+uew0nf4P+9JMQ+SnmePMbkuzww lomYBGe9Y1MFnBC5NABjrKqr4S7xWgW3vdAMrSUwXLnzWHtxe1yUxyWC8DxLTHK5DP/0 LeMkEKFTV5RuQhJ0kDc7obP9h1sbwsHo+rBKuN4GFF6MHzt4AqKajRlfaQOxUdVxeyxf H8wZPunBAN0XrxBdoNE8fbbhCNUQhbQw+7plqNsx/SN7A/1XyplwiTyGFZ1HJhcD1iFu /L4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=65FMNRHvXfBnRFwQV444VgyDPoRERLgrzU5KrsHA6mo=; b=D1yzjuO5GSFV9aKJMnKVJNET8C7THzzcsOrOye8x43tiF6a4Pv8i5AkpM7oiymXY3E WKKKbsDbrQ1KkJyr6sCQgdsNKVxNIfKeef3YxLQv4OOfZOcMzFu1eovmXCEDqHYio5N6 UB0qCgED/YbP78v62RM5kIg/DYavicv4fudVYWsxaUYRsu91WkTAGHTnn3H409v/Mw/r 0jEQsjWXctUyr383TADA5fgvimoPJDLNLPmXf1ygECwUf1WH2+s1xM6vtHOdi8F1QuUn 9QYiV++j1VGnwJyzIOTMP7jXlnSF2XXpbVnQ2p2L95kwCJaIlrthGbNByW1eMSXrWrQT EQtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OjvVq63+; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id x20-20020aa79574000000b0065a02d1d8f1si6470548pfq.379.2023.06.12.01.13.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jun 2023 01:13:54 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OjvVq63+; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1C87884780; Mon, 12 Jun 2023 10:13:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="OjvVq63+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 120C2860BB; Mon, 12 Jun 2023 10:13:25 +0200 (CEST) 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_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 E8C6B85FD2 for ; Mon, 12 Jun 2023 10:13:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rui.silva@linaro.org Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-30fc6b513afso135993f8f.1 for ; Mon, 12 Jun 2023 01:13:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686557601; x=1689149601; 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=65FMNRHvXfBnRFwQV444VgyDPoRERLgrzU5KrsHA6mo=; b=OjvVq63+EJh/OKLmSMlmM3Lla4uZ87mRXA9FenJOh/vLshOZUIRQIPaDbPLMFzBBtX nKmFM2izWXkTqp5B2OdDa8tA4/uxA8cHxCn6AwwYVjTmlaNSDgqg9oqkAnqkN8Bl+yhQ Y9kmarS/UXnPT2DzCbUWTrNn4LxKxUD/6/tuXleb4ujuV/igb245v5COlT1V/5oA7wtr UcPt32ZHPeBfCmqALunGGEqXXQiRdZfJVnRXQy/ICqrLTpiBPhOQXQFxp6kel9526F5o o3+AhwC8OId1d1+BIOqJ2OWIx9DFbQExSKjIPSiZI3xTpkI8461jb7b5jTf4waX+n3bF 8AlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686557601; x=1689149601; 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=65FMNRHvXfBnRFwQV444VgyDPoRERLgrzU5KrsHA6mo=; b=BZwY/ZVNc46MCBvf94O4LuE/jD9O0RQQzpVDjVrTR8yucR96/0uGtL+UW9Xolr+ysa c8XlGiuwl6H7za/DjBdVEMRyH8e4udNFC+pyGfmCN1nYOMEnegN0MNGDRHeU6b+tS+aW 3vBBqiLbJRdKXa99yEwK95RRFHBkCYEBvyQ+hTlEreBKyFuVTrM88plaAojGW4d5zZmQ lSC77dHps4jjwJ9H3QaenVLnfnK0pEXo/vnNI5gJmVO6CF6FQt/XHKmBEu1kuzLV7R79 0s/iPToAN2ZsUzOEYhjPwhm6tVihoyS3VGOoVGOEXaDaNv/KVJg9BY/MsDc4sWLNC65+ 7dCw== X-Gm-Message-State: AC+VfDwkA+2YbdJAxpW5GpvNh8fPXrO8aISHxXSWaaj0T2DAuKS9vVIX 6PoMaGxqY2VBpPIeVNNpIAM+NHj0b5prQCCyiF4= X-Received: by 2002:a5d:5704:0:b0:30f:bc21:1ce4 with SMTP id a4-20020a5d5704000000b0030fbc211ce4mr2301633wrv.14.1686557601070; Mon, 12 Jun 2023 01:13:21 -0700 (PDT) Received: from arch-thunder.local (a109-49-33-111.cpe.netcabo.pt. [109.49.33.111]) by smtp.gmail.com with ESMTPSA id m9-20020a056000008900b0030ae499da59sm11637390wrx.111.2023.06.12.01.13.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jun 2023 01:13:20 -0700 (PDT) From: Rui Miguel Silva To: u-boot@lists.denx.de Cc: Simon Glass , Tom Rini , Ilias Apalodimas , Rui Miguel Silva Subject: [PATCH v3 1/6] fwu_metadata: make sure structures are packed Date: Mon, 12 Jun 2023 09:09:15 +0100 Message-ID: <20230612081314.723786-2-rui.silva@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612081314.723786-1-rui.silva@linaro.org> References: <20230612081314.723786-1-rui.silva@linaro.org> 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.8 at phobos.denx.de X-Virus-Status: Clean The fwu metadata in the metadata partitions should/are packed to guarantee that the info is correct in all platforms. Also the size of them are used to calculate the crc32 and that is important to get it right. Signed-off-by: Rui Miguel Silva Reviewed-by: Ilias Apalodimas --- include/fwu_mdata.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/fwu_mdata.h b/include/fwu_mdata.h index 8fda4f4ac225..56189e2f40a9 100644 --- a/include/fwu_mdata.h +++ b/include/fwu_mdata.h @@ -6,6 +6,7 @@ #if !defined _FWU_MDATA_H_ #define _FWU_MDATA_H_ +#include #include /** @@ -22,7 +23,7 @@ struct fwu_image_bank_info { efi_guid_t image_uuid; uint32_t accepted; uint32_t reserved; -}; +} __packed; /** * struct fwu_image_entry - information for a particular type of image @@ -38,7 +39,7 @@ struct fwu_image_entry { efi_guid_t image_type_uuid; efi_guid_t location_uuid; struct fwu_image_bank_info img_bank_info[CONFIG_FWU_NUM_BANKS]; -}; +} __packed; /** * struct fwu_mdata - FWU metadata structure for multi-bank updates @@ -62,6 +63,6 @@ struct fwu_mdata { uint32_t previous_active_index; struct fwu_image_entry img_entry[CONFIG_FWU_NUM_IMAGES_PER_BANK]; -}; +} __packed; #endif /* _FWU_MDATA_H_ */