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: 678395 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp499375wrs; Tue, 2 May 2023 06:12:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5oz+3cZOLY6HTicKyvL0lgKYfxP5hVR88en3uAYbKO/DewGXXoMZe2tYcDjRV2kRIkoSod X-Received: by 2002:a05:6a20:8e23:b0:ee:bac2:c6e0 with SMTP id y35-20020a056a208e2300b000eebac2c6e0mr12602720pzj.44.1683033153226; Tue, 02 May 2023 06:12:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683033153; cv=none; d=google.com; s=arc-20160816; b=iyYwGJWaJPAySsJpME+YHBVmLO9xWv7arG5sLG8S9DqMvzDuYT187YRjrPrdHujA6B WiLx20RKwVF+iGSg1TrT7W6SZvJQkf9udXzBhpKBCa8rM0aBhzTYBZKVBTWK1xGTo6Tu cJBFjNgH0vvhOJe+AAQdue3+tlwl43UG4P39vU0L4MTsm1rnL+4tLCKjxSe0waRGt6SO 6CmLJI4CxBG9iw/VUxNc3/+8EVuzmaHVqSmpQpjRYMPTIfhfaFGIYX9csq6WpCipJsWy EtEtFpyIvuJr8TtNcwrfqRm/kttDe7k+YgLIKCEsRHI1HulU+xIL5JJXqgWL/SHSGsNf 6VxQ== 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=YkuaoCFV9B9612IdMsCHmsC97jW3CcgHDgumf8cJRWk=; b=1DDU7bPHsfIR+7TfQ0toazUquE6nMIBXkUu7oA4ueAH0zdZA/DbTspXphDi7x3YgPs w+df9id/H4BPB2H66yhrnw/EkuJEXtUqnUP8Oj2fIY1/CSjg+WN0RicnT5dZxijkp9KH S5s2lhiz16DLlex9u73CXLVqaA2bFR9MdS7BJfUCG9fItJZjcHm+BgXyblH5xcMtaE08 1fBwHh6U63tMmETqYcGF/ynWj3i2MWyY5DL+dx8iPSa041KZtAgEd7O1VrMwRtc5XLxe JjOqoxCUXINVmt3C+Hl8X3j23ODHLNKieUB6ebfmFoMKqZ0zNQuCWFSTEErevN6TOZz0 1SOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m+2fawWI; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id u62-20020a638541000000b00525049b622csi23543585pgd.71.2023.05.02.06.12.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 May 2023 06:12:33 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m+2fawWI; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 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-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_ */