From patchwork Tue May 2 13:11:55 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: 1775878 X-Patchwork-Delegate: trini@ti.com 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=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=m+2fawWI; 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 4Q9gV74J6Rz20fd for ; Tue, 2 May 2023 23:12:31 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8733F84743; Tue, 2 May 2023 15:12:18 +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="m+2fawWI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C1AE88473C; Tue, 2 May 2023 15:12:17 +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-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) (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 B12B884734 for ; Tue, 2 May 2023 15:12:15 +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-x336.google.com with SMTP id 5b1f17b1804b1-3f182d745deso36638805e9.0 for ; Tue, 02 May 2023 06:12:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683033134; x=1685625134; 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=YkuaoCFV9B9612IdMsCHmsC97jW3CcgHDgumf8cJRWk=; b=m+2fawWIoT5AphFO+AFb7k0h+cGMPi9wzppze99bxHHofrP8hTcs11fVMloshDEC1i WSsIWRXh+l7QeLMmJvQStGSPV/V+kyR5lly79G8aB/GJBaltbFk4+b+phs1ZjRzoz/aI X+cB8zLZPQs+c66frdntm1zrjs0GSMuv4DZHv5ZF9e1c4MrSutBYWdmTRCnaSps8h4/H taZhcKE+0PIb9m7bz/gs+juucRwRnXVOktHQnLPZZncAstN+AXi8R/OttkyTYQ0gtSGe pdBhEqMohu6Qkh44isrjv0DwmwMgtu5kGIm/lZplGHshBbsTMnYrZb3ao35s7Vv/sn7v qSrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683033134; x=1685625134; 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=YkuaoCFV9B9612IdMsCHmsC97jW3CcgHDgumf8cJRWk=; b=eRnsMNC8dN2CLLeVDieJdLiEUXOIhGGyxINvUnybfDJTdEsKBYKZQrOhIXCxajNy08 GsURK999NcwRywNwQgMd0eq1jJIXyCQr+zU26Cro2tEMTJmL5h/tZsuAoUt7XPtCALMt FBy49YvPlj/w66QMNscm+SmLJtaRpOkHHy3KYwKjkcXhOr862j+k2UsM/0DpD7yT52b9 MOAvQTEeknBKEA6OdPYJAj4DYarCcztpv5bphq12O/+U3hKnmrEMtpIDDB033Rk5/Zd0 qXw6mexOie/PtttRtxpb93kDGOfiGjOjY1bU7ERbmhpdsSzV9Yo5u+wW5FFNM0YdnPcz Z++A== X-Gm-Message-State: AC+VfDxvTUzjvm/PfG/czHbkEVmkm/TZhgdUCqvlzmUvdNiwK7jY2ZVh fczreJlmYTZIt+VcRhjSDoY9IesvnHO8zbm+KNQ= X-Google-Smtp-Source: ACHHUZ5l/jpj6EqQTChmDIZc22vu5Uhw3JPEOMy/huX+MTlqdzWFuUSMMkKlGPNs5M6mL2QPZoLr3A== X-Received: by 2002:a05:600c:2296:b0:3f0:8ed8:853c with SMTP id 22-20020a05600c229600b003f08ed8853cmr11874923wmf.37.1683033134528; Tue, 02 May 2023 06:12:14 -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 c21-20020a7bc855000000b003f17300c7dcsm35277121wml.48.2023.05.02.06.12.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 May 2023 06:12:13 -0700 (PDT) From: Rui Miguel Silva To: u-boot@lists.denx.de Cc: Simon Glass , Tom Rini , Ilias Apalodimas , Rui Miguel Silva Subject: [PATCH 1/6] fwu_metadata: make sure structures are packed Date: Tue, 2 May 2023 14:11:55 +0100 Message-Id: <20230502131200.2551513-2-rui.silva@linaro.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230502131200.2551513-1-rui.silva@linaro.org> References: <20230502131200.2551513-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_ */