Message ID | 20230918122659.92014-3-thuth@redhat.com |
---|---|
State | Superseded |
Headers | show
Return-Path: <slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=R/NAky8x; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=R/NAky8x; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rq3vq5Plbz1ynX for <incoming@patchwork.ozlabs.org>; Mon, 18 Sep 2023 22:27:19 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=R/NAky8x; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=R/NAky8x; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Rq3vq4L1Bz30NP for <incoming@patchwork.ozlabs.org>; Mon, 18 Sep 2023 22:27:19 +1000 (AEST) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=R/NAky8x; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=R/NAky8x; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=thuth@redhat.com; receiver=lists.ozlabs.org) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Rq3vb4YHWz30NP for <slof@lists.ozlabs.org>; Mon, 18 Sep 2023 22:27:07 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695040024; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qiFU3BW4Bzn+rcehjGX1kpl8PRWnTj9hvKJwK7d1Kgw=; b=R/NAky8xriVPDmeKEAliUWkyeQBdr7kknSiszE+o3rT/eh1HM81kuvhTc1/DrOQ7BamMVX GX6xK8VOkYImus5RqMnW+oES94eYK8hemoqEUHpdl8csd+2BxviNENzquHh4rAXUHdUCUA AB1GgLRY8824krhorQjqz97vIw6k17g= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695040024; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qiFU3BW4Bzn+rcehjGX1kpl8PRWnTj9hvKJwK7d1Kgw=; b=R/NAky8xriVPDmeKEAliUWkyeQBdr7kknSiszE+o3rT/eh1HM81kuvhTc1/DrOQ7BamMVX GX6xK8VOkYImus5RqMnW+oES94eYK8hemoqEUHpdl8csd+2BxviNENzquHh4rAXUHdUCUA AB1GgLRY8824krhorQjqz97vIw6k17g= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-505-aLWzGnimNHCrz1-fa6UTvQ-1; Mon, 18 Sep 2023 08:27:02 -0400 X-MC-Unique: aLWzGnimNHCrz1-fa6UTvQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F1F7429AA386 for <slof@lists.ozlabs.org>; Mon, 18 Sep 2023 12:27:01 +0000 (UTC) Received: from thuth-p1g4.str.redhat.com (dhcp-192-205.str.redhat.com [10.33.192.205]) by smtp.corp.redhat.com (Postfix) with ESMTP id A212D49BB9A for <slof@lists.ozlabs.org>; Mon, 18 Sep 2023 12:27:01 +0000 (UTC) From: Thomas Huth <thuth@redhat.com> To: slof@lists.ozlabs.org Date: Mon, 18 Sep 2023 14:26:59 +0200 Message-ID: <20230918122659.92014-3-thuth@redhat.com> In-Reply-To: <20230918122659.92014-1-thuth@redhat.com> References: <20230918122659.92014-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [SLOF] [PATCH 2/2] lib/libtpm: Silence compiler warning about unaligned pointer value X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" <slof.lists.ozlabs.org> List-Unsubscribe: <https://lists.ozlabs.org/options/slof>, <mailto:slof-request@lists.ozlabs.org?subject=unsubscribe> List-Archive: <http://lists.ozlabs.org/pipermail/slof/> List-Post: <mailto:slof@lists.ozlabs.org> List-Help: <mailto:slof-request@lists.ozlabs.org?subject=help> List-Subscribe: <https://lists.ozlabs.org/listinfo/slof>, <mailto:slof-request@lists.ozlabs.org?subject=subscribe> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" <slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org> |
Series |
Silence compiler warnings in tpm code
|
expand
|
diff --git a/lib/libtpm/tpm_drivers.c b/lib/libtpm/tpm_drivers.c index 85cb309..ac28072 100644 --- a/lib/libtpm/tpm_drivers.c +++ b/lib/libtpm/tpm_drivers.c @@ -37,7 +37,8 @@ struct crq { uint16_t len; uint32_t data; uint64_t reserved; -} __attribute__((packed)); +}; +_Static_assert(sizeof(struct crq) == 16, "padding in struct crq"); #define PAPR_VTPM_INIT_CRQ_COMMAND 0xC0 #define PAPR_VTPM_VALID_COMMAND 0x80
GCC v13.2.1 complains: tpm_drivers.c: In function ‘spapr_send_crq_and_wait’: tpm_drivers.c:153:9: warning: converting a packed ‘struct crq’ pointer (alignment 1) to a ‘uint64_t’ {aka ‘long long unsigned int’} pointer (alignment 8) may result in an unaligned pointer value [-Waddress-of-packed-member] 153 | rc = hv_send_crq(unit, (uint64_t *)crq); | ^~ tpm_drivers.c:34:8: note: defined here 34 | struct crq { | ^~~ Since all members of this struct are naturally aligned, it's indeed better to avoid the "packed" attribute here and use a _Static_assert() to make sure that no padding is added here by accident. Signed-off-by: Thomas Huth <thuth@redhat.com> --- lib/libtpm/tpm_drivers.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)