From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 01262C76196 for ; Fri, 7 Apr 2023 01:46:25 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2B4BC86136; Fri, 7 Apr 2023 03:46: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="jxZphQq1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2BB4686119; Fri, 7 Apr 2023 03:46:19 +0200 (CEST) Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) (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 18DB386097 for ; Fri, 7 Apr 2023 03:46:14 +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=takahiro.akashi@linaro.org Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1a296519dc8so637975ad.0 for ; Thu, 06 Apr 2023 18:46:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680831972; x=1683423972; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=oej6GRGWfYvTgfkCbrCrwPRvYUg2/is5s+Ng3+U7AQk=; b=jxZphQq1MvWs0y0jqeGQA0fI+qNM+LjhPSZHvpbtk0oq+XEk5ndDNbbAMAsKPj6QzP iDDSs8Sf+d9tV9F5FOCdpG/uztERkhz6tJ0FpK559R7+/pVOdSWvAcYcE2JxTBQan/4F Kk2092BLXFoTm3pCWkqBx/raZjr5U25REF0pkm/YiNqGyQLDsqy7oOhSxVQ16/jGF0lu P5m44pzTXXQ4a9GMFnpIOeRnjNTiT7tZtq3imN2r0FWrZhBFzQVzQ9ZusMenvTsrlq3c f+N9qXNTOOjkytkPuoX2h2cDBQQjKdwn8l8/whtXXjElDI8cIlUfaABxLA6NkjfwEOJA m54w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680831972; x=1683423972; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oej6GRGWfYvTgfkCbrCrwPRvYUg2/is5s+Ng3+U7AQk=; b=X/Rq56MRhP5YODkoyiMxjBSFT4xzrBwm+Y5GwslZgE9bSCRDyOHkCYT69ZCpW4bLda vIDmgTtWZGOtDGzaDQjkJjn1IDh/0QveoQgfBb9dqLwYBTk0zhiDnkE+BfxWaWPpFE7a CsReSVElbMibnQf1HgBO2WVea6dXncwOWmRYSIhTVJp+ZEn0RIjSkJ6jCvNAUbayGHoP AAslOGPUUrsEsMmqoj3Cbn3qAZ0aPueAl85BAAWml22sFq6cocQDc4p5M75t4Dr+9S0r GIT605+khIkxvk8kxfwZsI+9PQcYNUr7EMAYD0Mcw1OqSgxvqvVzPC4VajO/2oiQ7kcY lPug== X-Gm-Message-State: AAQBX9fnERHXw6nWuJXoOi8a4yCUyw6tgS2Nl7xell3/jawyG4e08d/5 xhga33BY8h0C/1Mf4PqPkobznA== X-Google-Smtp-Source: AKy350bWs1hqI8INr25ZWKfp1ZWex6ygKr7NscH3nJMJsL1NamsA9TQVuqzT6wh8ySW7xRafcqwXGA== X-Received: by 2002:a17:902:ecc2:b0:19a:7060:948 with SMTP id a2-20020a170902ecc200b0019a70600948mr971476plh.1.1680831972131; Thu, 06 Apr 2023 18:46:12 -0700 (PDT) Received: from laputa ([2400:4050:c3e1:100:1e3c:1fb1:eb92:52ba]) by smtp.gmail.com with ESMTPSA id bb17-20020a17090b009100b0024491c99276sm1684827pjb.43.2023.04.06.18.46.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Apr 2023 18:46:11 -0700 (PDT) Date: Fri, 7 Apr 2023 10:46:08 +0900 From: AKASHI Takahiro To: Ilias Apalodimas Cc: u-boot@lists.denx.de, Tom Rini , Heinrich Schuchardt , Heinrich Schuchardt Subject: Re: [PATCH 2/2] efi_loader: Fix warnings on unaligned accesses Message-ID: <20230407014608.GA42603@laputa> Mail-Followup-To: AKASHI Takahiro , Ilias Apalodimas , u-boot@lists.denx.de, Tom Rini , Heinrich Schuchardt , Heinrich Schuchardt References: <20230406193707.2238981-1-ilias.apalodimas@linaro.org> <20230406193707.2238981-2-ilias.apalodimas@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230406193707.2238981-2-ilias.apalodimas@linaro.org> 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 Hi Ilias, On Thu, Apr 06, 2023 at 10:37:07PM +0300, Ilias Apalodimas wrote: > 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. There are a couple of 'struct' definitions which are *packed* and contain an 'efi_guid_t' member in efi_api.h. If 'efi_hii_keyboard_layout' is the only place that causes a clang warning, we need a more specific explanation to clarify the problem. > 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" That's right, but this text in this context may sound misleading. (It doesn't explain why 'efi_guid_t' is 32-bit aligned.) -Takahiro Akashi > > 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 */ > -- > 2.39.2 >