From patchwork Mon May 29 14:02:24 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: 686704 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp250339wru; Mon, 29 May 2023 07:03:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5F7yekUG7F/EHUB0uTULvxS/cmxFAnx6UUoQ251cEJIRk2bNI0wkavF6p+T6T7p2Yyrkzf X-Received: by 2002:a17:903:1250:b0:1ab:723:1acc with SMTP id u16-20020a170903125000b001ab07231accmr13141760plh.35.1685368979931; Mon, 29 May 2023 07:02:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685368979; cv=none; d=google.com; s=arc-20160816; b=HMbMiobjCFPfUipqrFWGV4GhcypsaIZikTZtFmuN5rB9kHtieGGOMMz5ybshLgrlT4 y7HbSUFGnNZMhoP2PQZYeqH5EKdnZ7BGVqXqsP6F+r6YbGnK8op8zpU97sBwy+2zIu67 HjWWU0tWB38V1I5hBDDMWEXTe5m7tuDkrtxUj+sbQ4ND/iTCeksazMGUu8RX6wfDSp5J McVbyaK7SMeqhoOAhteNoyzK8aglgeSNvA3Hy7+5fPdMGMzFYwRET1/xAHe8jXGr5kjp 0zOCrTAxF4ReMrq2P0BdOJEjx7fhPP1kRT7e+H8c84FY+zx8KXOFDxRWfK1uZgAmhbRF 5Ykw== 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=nbh7PmhEYBIwOQyUkpV/fcwlIjJ1wiXnFCun1L3U3Mk=; b=qmWbW5PIGFxQ+rLZiR6eiKZqexzE2zzQ5Z4HDxZJ741jLzpNIisbyckOlutdf7zWFp OvogLavwhFICM45VXLgw9Zm1xcJPVUQW5Op7a9Iv6j6pUQ9rNy8LhmVm9hxyUtnPFfxJ a/A3vO5IrE+pGEyz4tQDFJUQ71fySso/mGZigUaJydT8Lz19X03IMvjIRMDNxp4w/dXE J5Yp1weJ+aB0qc8TMS9AjQZfwgJMfKeQ0ucP/02x3fjUuZ4HvIzzDsKis/ppw9+A47iq OnbltBhLM3tSv1IKsAmA2Cit1h1nkxu094T9i76f8nhOwq7IE4H1VQYL4TsZ34hdxulL bB4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dIufOCoz; 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 o21-20020a170902779500b001a197aa18fesi9274831pll.121.2023.05.29.07.02.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 May 2023 07:02:59 -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=dIufOCoz; 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 9A25885BFB; Mon, 29 May 2023 16:02:41 +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="dIufOCoz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3ADA985B8A; Mon, 29 May 2023 16:02:38 +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-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) (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 DEE4784791 for ; Mon, 29 May 2023 16:02:35 +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-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3f6e68cc738so21970315e9.1 for ; Mon, 29 May 2023 07:02:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685368955; x=1687960955; 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=nbh7PmhEYBIwOQyUkpV/fcwlIjJ1wiXnFCun1L3U3Mk=; b=dIufOCoz4efpdLLtDS0cdG22OlU/H4eKga8gZ9SkkZsH6iDap0NAzModJoBOIDhYgb aDCGhwMVDKDChFAosn/Cos1lLXtMvBAZOTPK0ljC7TAWZmd2bnlsgkJfzQ6tWRijp/qP lD7aaowA0Q6LNJ/5Lv9WC3dynCwk+RQiqfY887G3io+Qs8CTG3eq8K0hPYD4RXEvBHtQ KGRN9p23XES0pCad6s9LNS/UHlypOmoS856JvLKkGaEMZ/SeqJcsjNdi1cuiFLxfoA29 uBkfFnqHECwvq1R83rZFkyQzKQsrgGV3eQd4SK0wTI5b/+g9vw2Lr6i/5pqszC4cIwFk fzAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685368955; x=1687960955; 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=nbh7PmhEYBIwOQyUkpV/fcwlIjJ1wiXnFCun1L3U3Mk=; b=aizP9cdzZhN9ByKo/2MRFSi6iv9OErTSqp9HAIDLP9KCRMIG9SLkXSfnLGcuQQHmpA 7w+0WtIz+VrdNUbuA+01P68JagUcrtLrYV7YbMspeAxl9ajGVlG4RyyYZFVEn2i8zqtY h2Tkd4e7nhCsp87zPQFcB1/SDHeaQuxsJHwkFiGhaaNlNE663TezJn6uxmj9om40YEo0 N00h2KAhkEKIyISC61oa4fn/wJo09rPa4+lW951uHMihOo66j1RkmemHW6geWR86IwlQ bIa+JIeFGvOpE6cwLTV9/vPDufPL8mAU3+f/jhhYwt0H+o1ZWPh2F2081ORzqeNjrWaB 3iWA== X-Gm-Message-State: AC+VfDwAsjaCaW7eeViNUZqYOcT2P1d/s3XR3+lK1DcWXvGNco3otC36 8dAN/xawBeBu2k74dH4iF9ediifnsNCJ8IIAEAY= X-Received: by 2002:adf:e8cc:0:b0:309:419b:925d with SMTP id k12-20020adfe8cc000000b00309419b925dmr9233074wrn.70.1685368955150; Mon, 29 May 2023 07:02:35 -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 w12-20020a5d544c000000b002fed865c55esm54123wrv.56.2023.05.29.07.02.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 May 2023 07:02:34 -0700 (PDT) From: Rui Miguel Silva To: u-boot@lists.denx.de Cc: Simon Glass , Tom Rini , Ilias Apalodimas , Rui Miguel Silva Subject: [PATCH v2 1/6] fwu_metadata: make sure structures are packed Date: Mon, 29 May 2023 15:02:24 +0100 Message-Id: <20230529140229.3225090-2-rui.silva@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230529140229.3225090-1-rui.silva@linaro.org> References: <20230529140229.3225090-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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/fwu_mdata.h b/include/fwu_mdata.h index 8fda4f4ac225..c61221a91735 100644 --- a/include/fwu_mdata.h +++ b/include/fwu_mdata.h @@ -22,7 +22,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 +38,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 +62,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_ */