From patchwork Thu Apr 6 19:37:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 670763 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp1026905wrt; Thu, 6 Apr 2023 12:37:22 -0700 (PDT) X-Google-Smtp-Source: AKy350Z9G1V48M6UKbaJavXe7ZZMgz9xho6glKVbU3cDNc6tdMfM8bFrz2Mwh1p8Ljkkfhcf6haP X-Received: by 2002:a6b:ee01:0:b0:74c:8b56:42bb with SMTP id i1-20020a6bee01000000b0074c8b5642bbmr4788215ioh.8.1680809841816; Thu, 06 Apr 2023 12:37:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680809841; cv=none; d=google.com; s=arc-20160816; b=z58IPYPZ6oMs3MjfGJ9FxCWDLfe0hhhTSVxV2Ic5ixzemwqsdkl+mG8u1jGeP4PRYA CeQFzxmhIaGWQdFXJkObdX9fdPE8DIavPU0D7yFYo9gqC1KcxeYZGdVk6deZluOLJUUR VA6WcnFOi4Kl1fB6p0TKlX4M9RU3AExK5MzmRIns2chx1iVYN9wQrt793uS4b4oc0C2M BZ1AYc07lTdvUXaIkBZDyfPZi7TtUetovV/3gbdVhmcwSvQNYKBRYsWHiSVkAbWwHNKP 1UzwfA2UpnUmsY2x7LWQ1BQXJExrcRvvJgy9Iafi6g/d3tGimITd5X+GnzUtaF+tB+Hd PbqQ== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=orG6+czDNy5k3DxoyGDd2A2/EEmsmI3OJ6eVnBo7L+c=; b=SyC4DzVBvvsR7rbzPLMdeWvelagNfJNI+qsoj3TiVJ5l5kbMx/hA+5TBXHpvEqOKGJ jORzurzkakLl17Bbjdu0h1H0WA9INdjcXDDJre7IYVJMIp8gck5joK0SCbQw4UGCOblZ pHxbi//H6vO0bMOoH6F0elLSPJAMkcm3go7U9185ZOR+NaYVZYeUXTkv3XiIPlahKYE+ IXEznus2wCqzrSOxHDEGASxglxH/j7jRjLy72CoknmetVjoPlxHYr4NlCzPH1Ua/wgHh dIfcSi7RqTn0uN8K8g5vLz7s69jVHI31/3eQ9xDQDjOmfuW/pjeZLe/+2xRXmaQpf9dA x9jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HuWLQd7E; 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 c4-20020a5ea804000000b007594f3ae46esi1479344ioa.126.2023.04.06.12.37.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Apr 2023 12:37:21 -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=HuWLQd7E; 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 1E7DB860C2; Thu, 6 Apr 2023 21:37: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="HuWLQd7E"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 532E086029; Thu, 6 Apr 2023 21:37:15 +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 autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) (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 D5D99860A0 for ; Thu, 6 Apr 2023 21:37:11 +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=ilias.apalodimas@linaro.org Received: by mail-ej1-x62d.google.com with SMTP id lj25so3938173ejb.11 for ; Thu, 06 Apr 2023 12:37:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680809831; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=orG6+czDNy5k3DxoyGDd2A2/EEmsmI3OJ6eVnBo7L+c=; b=HuWLQd7E6Quh6qos7Np0FE6rrDpaOEg3sLpjIP4z210701VeU1a5gd9jcAPhSfzrz1 fljLEwqL8OZyWCxRG8asZsQ5bJP2fNlReYwtyU/JX4ys/tTHzBq6UdbU3vO83fjkKz7Y /G0y63t/Akz1EMnuSMvtnMdsisscO0nj1L7EBvEm4hgd/x3T5ESd7zcqAHQOG9gcKF26 6fUM00cGXR2FqL8U03qdTU49baf7BraAEryo8TglFz+Wa26FwfVftPeS9oc/1EdPf8yJ kk2AybeCVHjN9GYn4AilwxtFYyYYBQWn/0NIJcUgUcQdQ4o7zqkyiKO9nj6y2x4K6M6O pF/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680809831; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=orG6+czDNy5k3DxoyGDd2A2/EEmsmI3OJ6eVnBo7L+c=; b=1ObkTkdMliHiSM+aER2uEKWlrtaK+eE0+Bi15H1rdUvT1ewNRQ2cX7xokke1WFJb9k fq49OFyhSTGR/RNrjCly8HvSMU67sXU2osuk5idAxvvudKi7twFLtmbDhYFlYUIICUem 0DbP//a8lJqCf37mpglHKhlAlUaRlMquDYshon7Kg/kYbC6mbax59mFTMZ6fSDji8FhY bllvY7ehO4iYbv/vgVLQaEpX1nIr/n73Xsdm84KktdtIbc9Stc624Gwu/yYUqAdNawYl FSbVmubMZd/xAUGMOE/70eT24fm0l0Cbkb1c20h9DDcAFn9AQgRkxWLAFbzUaMQSxxkJ WOfA== X-Gm-Message-State: AAQBX9cbhjPZYzX9yUYaT+qsEfaqmpjWYI7LqVaCOkfFsaSloh+SWkM5 zGV/xOvTA6gSrlHjPmyy/UVGNQ00D730TGu3F6I= X-Received: by 2002:a17:906:150a:b0:932:4255:5902 with SMTP id b10-20020a170906150a00b0093242555902mr6925308ejd.76.1680809831268; Thu, 06 Apr 2023 12:37:11 -0700 (PDT) Received: from localhost.localdomain (ppp176092130041.access.hol.gr. [176.92.130.41]) by smtp.gmail.com with ESMTPSA id k2-20020a1709060ca200b009373f1b5c4esm1164078ejh.161.2023.04.06.12.37.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Apr 2023 12:37:10 -0700 (PDT) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt Subject: [PATCH 1/2] efi_loader: Fix flexible array member definitions Date: Thu, 6 Apr 2023 22:37:06 +0300 Message-Id: <20230406193707.2238981-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.39.2 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 When a structure contains a flexible array member, it is not supposed to be included in arrays or other structs. Quoting the C spec [0] "Such a structure (and any union containing, possibly recursively, a member that is such a structure) shall not be a member of a structure or an element of an array." IOW efi_hii_keyboard_layout should not include struct efi_key_descriptor descriptors[]; since we use it at the declaration of struct efi_hii_keyboard_package. [0] https://www.dii.uchile.cl/~daespino/files/Iso_C_1999_definition.pdf chapter 6.7.2.1 Signed-off-by: Ilias Apalodimas --- include/efi_api.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.39.2 diff --git a/include/efi_api.h b/include/efi_api.h index dc6e5ce236c9..2fd0221c1c77 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -1173,7 +1173,7 @@ struct efi_hii_keyboard_layout { efi_guid_t guid; u32 layout_descriptor_string_offset; u8 descriptor_count; - struct efi_key_descriptor descriptors[]; + /* struct efi_key_descriptor descriptors[]; follows here */ } __packed; struct efi_hii_keyboard_package { From patchwork Thu Apr 6 19:37:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 670764 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp1026971wrt; Thu, 6 Apr 2023 12:37:35 -0700 (PDT) X-Google-Smtp-Source: AKy350YBlKy1K+78L1RB5YaTHM97Ioi9POuu5WB99WtRUqYzuDexhi9eJS2ps0dW+stHQB+gkkH8 X-Received: by 2002:a5d:94c1:0:b0:715:3123:9514 with SMTP id y1-20020a5d94c1000000b0071531239514mr539221ior.3.1680809855244; Thu, 06 Apr 2023 12:37:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680809855; cv=none; d=google.com; s=arc-20160816; b=nfZ86SMCKxHIME2nxdVYwN9hR+QAhGM1MygCr/IL1jfdxJYP7803ix5Rj9DYt5POpl epPNJe01FIgETeOu1QJtDiN3k8DOxZGkApd5M88qBrH1f5Q4Wsd9pyuX6oZjH0uoO9gW zobugmWFewXCisKcVdL+o86ukDF7QW3NfpgGKcSaoCStqeONiJMvy+zu6Mg9qq4AIseu oC1h/3TxZTe+ZD0RkSdNlYPsUqW+zILt57iiZEXD8LBZFjABoGtrENsJULKAvyznOdk9 5fGtxFaPi9pyYL7W4271rs8jorBkQe9DQ13AsxmRhvW4ocboFVvPYckKJczYnJEnEhW+ selw== 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=6zLLqIVHL9n0dgpcS2OBaWamq+gdVgDV2pC6Y/6Kryg=; b=wfA5fwcPZ36DpzOYr7b3WoH/GYNkMXg5rFK59vToDxiJq7UBnwilDP4MZfpZJg0Eqw M0G8G+LzUa7ep70yaqVCSvrYpQaQPzhvzAWlTXxdtL38RqLlJu0k9+PuJrPc53Q5gZOt Aw1Ay5wFISb7Pruv3Kq5MZpwrDB1yBeLswpPlFkqmAV/LyvJm/EKEg7/1mAxf7tnCGKx mWwwtHoleB8ulLwO72uFWaniQN0Eu2nr+hOuptxGlWiZKDXrfBXGloTa69Uvzlo58KCD xrVepTMbl9o6dzAaBKtorWAGsCJGDXkOh+ELk+3LQI47nentQACMYcDT1QFmM9oZBqqo Dwuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xBGci2ZT; 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 b2-20020a5ea702000000b007594f3ae468si1544702iod.120.2023.04.06.12.37.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Apr 2023 12:37:35 -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=xBGci2ZT; 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 5BCDF86065; Thu, 6 Apr 2023 21:37:22 +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="xBGci2ZT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8FFAB860A0; Thu, 6 Apr 2023 21:37: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 autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) (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 68F53860C2 for ; Thu, 6 Apr 2023 21:37:13 +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=ilias.apalodimas@linaro.org Received: by mail-ej1-x62b.google.com with SMTP id g18so3943550ejj.5 for ; Thu, 06 Apr 2023 12:37:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680809833; 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=6zLLqIVHL9n0dgpcS2OBaWamq+gdVgDV2pC6Y/6Kryg=; b=xBGci2ZT/Fi5uL1JszgfEs+Y3Qm9l80jmS3hdmJhap8oRZQNqi6bPSRxg79yhmgUgr i00Xu/TFxErtgWo1BBUMq1yHMpadEBoQ0lKA1vGjz6F2FZLTjDior8nReWWn/LfL3Wb/ P+cVly1op3EqYH/QsCqyLFjQKO8DeiZt7pgWEOSeWeFtRpQD0456UvHmR/YvAI4CD8R3 HUHLi7xI01nzntQGqLKztZat6928diuocIjzcQlTRpbHvJEh9TU7minaKzPOAoqD+gzA p6rr5xs/HWARjKt9pFvlN+P9AKbpM+TOCiYn/wlWvYcI1VJFbiT4THQjsnjL+J7Vdr6/ UrrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680809833; 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=6zLLqIVHL9n0dgpcS2OBaWamq+gdVgDV2pC6Y/6Kryg=; b=kXBP/uTfT5GDFkQ+YxQdrIWbxIJCJTVhSLTIhTpPxVyMrVJ+0y0tRgHUMwwFZxMCb6 SqmaV7Nn8VqvDA/zZRYCOWnGF9b4BFYXcOPXf05L6DAgJ/CS8aVVlxdNE8MSK7uXiIXA Z5TZ5lZjZGHDQiXK2Pity0Q/7TBq6GuWQMxgscu14O36MytsQcZOnfDF6UZqliyFHCNs YLbG91tJhCwReAybMTdxbW+Vq2OTM4rtwutwLnX4PAlmPRVLus7xU1kXh+E0LisvGkGw SZKqbTbnFMnnsT9v/agrPFdefGgn6LFSZ1BMo5SmdWBNUOgaH+BDI8IFe4KsRx+KoP/L X7FA== X-Gm-Message-State: AAQBX9dCg1Ia8VrxGkGAVo1MirPAE36xq0/cokhVHDTooUDOcjuDcw04 hrAqWMVeT49BRFnYVCcZCWxB8i42tCeyAGJuJyw= X-Received: by 2002:a17:906:fe05:b0:947:d875:68f9 with SMTP id wy5-20020a170906fe0500b00947d87568f9mr7240448ejb.0.1680809832952; Thu, 06 Apr 2023 12:37:12 -0700 (PDT) Received: from localhost.localdomain (ppp176092130041.access.hol.gr. [176.92.130.41]) by smtp.gmail.com with ESMTPSA id k2-20020a1709060ca200b009373f1b5c4esm1164078ejh.161.2023.04.06.12.37.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Apr 2023 12:37:12 -0700 (PDT) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Tom Rini , Heinrich Schuchardt , Heinrich Schuchardt Subject: [PATCH 2/2] efi_loader: Fix warnings on unaligned accesses Date: Thu, 6 Apr 2023 22:37:07 +0300 Message-Id: <20230406193707.2238981-2-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230406193707.2238981-1-ilias.apalodimas@linaro.org> References: <20230406193707.2238981-1-ilias.apalodimas@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 Tom reports that when building with clang we see this warning: field guid within 'struct efi_hii_keyboard_layout' is less aligned than 'efi_guid_t' and is usually due to 'struct efi_hii_keyboard_layout' being packed, which can lead to unaligned accesses [-Wunaligned-access] This happens because 'struct efi_hii_keyboard_layout' is defined as packed while efi_guid_t is 32bit aligned. However the EFI spec describes the EFI_GUID as "128-bit buffer containing a unique identifier value. Unless otherwise specified aligned on a 64-bit boundary" So convert the efi_guid_t -> u8 b[16] here and skip the alignment requirements. Reported-by: Tom Rini Suggested-by: Heinrich Schuchardt Signed-off-by: Ilias Apalodimas --- include/efi_api.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/efi_api.h b/include/efi_api.h index 2fd0221c1c77..b84b577bd7b5 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -1170,7 +1170,7 @@ struct efi_key_descriptor { struct efi_hii_keyboard_layout { u16 layout_length; - efi_guid_t guid; + u8 guid[16]; u32 layout_descriptor_string_offset; u8 descriptor_count; /* struct efi_key_descriptor descriptors[]; follows here */