From nobody Sun Nov 9 17:51:08 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1551729992590322.5622090792326; Mon, 4 Mar 2019 12:06:32 -0800 (PST) Received: from localhost ([127.0.0.1]:60230 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0tr3-000809-Eg for importer@patchew.org; Mon, 04 Mar 2019 15:06:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0seY-0001OH-FP for qemu-devel@nongnu.org; Mon, 04 Mar 2019 13:49:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h0seW-0006eU-Eo for qemu-devel@nongnu.org; Mon, 04 Mar 2019 13:49:29 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:46752) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h0seW-0006cU-4H for qemu-devel@nongnu.org; Mon, 04 Mar 2019 13:49:28 -0500 Received: by mail-wr1-x443.google.com with SMTP id i16so6705481wrs.13 for ; Mon, 04 Mar 2019 10:49:28 -0800 (PST) Received: from localhost.localdomain ([176.228.155.165]) by smtp.gmail.com with ESMTPSA id r70sm8130743wme.46.2019.03.04.10.49.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Mar 2019 10:49:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=SSsOl/9yiIQ+LC0hmYrY1feUq1OIabmYTfr7Xv1bwQo=; b=FB3Y146p5TzK98Tws7DJRpwnCYph7mJAG7X556inz1lU8wUrIKwMJ2nUROYHtQ504D Plr/BGlH0uwxIE/VfWEcCccNLA+pNexjmWW5AgW0e30SDhI1Kdt/k7nQDwyRstwBKfQQ MrkWunWuFNXlW4pvoVow/foWtA4yptJOMQihaYsRilUQKc9CIyG9LYQ05BJNl9rjUpls KOeh+lzngOeVrJ4h/+yRP8VzdVtzYFRd/D6iz8BiKCrMTodufKUMyY5mmPijE0CS3yxR 4+jljycObnDJb5FVbDuBhqA6sp7SilVBJoYUgygpF9Rm3vSCmQoA5QsWicbP4sC/iNnj pmPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=SSsOl/9yiIQ+LC0hmYrY1feUq1OIabmYTfr7Xv1bwQo=; b=RBwTX4hAMr8ksBj1ogTnZ7MsuyKH42ZCn0YhDE+Y6OuKeYULls12boETz2ANwKtkqZ Mt6wT1m1//KbRDIex2C81DKNRceQKKKkW5K/kG9bgRATz4IMvNEWNxE8nBCE0LgiAY0H y9CscpQa194qlo9ZFJdVPYL8XTUflOrXzznj1rUWqdZcJhcXAoALbRqTo9jOS4CGSE2e rF6tphlfvxR44J7Qs/Vm1U+XGxA7yf7o61ppAjZrPuL/Mpp5QoVlr3SkAlvjvLdK/SA1 /soXySLfmU9sjE53M+B4+IDTP3LL02YaDbD1zxu5yLf7gzmo1SrlXN+vuO6MlW+oNUbK xNrA== X-Gm-Message-State: APjAAAUUdlJTkJ1/QIMlCD4nTpkzHwOcCuvUeQgf8bqu0XjAX/HO/b/x aF9SgYHIfXY749ObHUNQDYdC/uUW X-Google-Smtp-Source: APXvYqxfkDigCKTnVu8/BDVNgWysuru8ZcPIJj8eCs/jDPOLLW/1ZGrGbK24dj5ETBj8Aymr0kUmdA== X-Received: by 2002:a05:6000:10c1:: with SMTP id b1mr13053292wrx.275.1551725366412; Mon, 04 Mar 2019 10:49:26 -0800 (PST) From: Marcel Apfelbaum To: qemu-devel@nongnu.org Date: Mon, 4 Mar 2019 20:49:23 +0200 Message-Id: <20190304184923.24215-1-marcel.apfelbaum@gmail.com> X-Mailer: git-send-email 2.17.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 Subject: [Qemu-devel] [PATCH V2] migration/rdma: clang compilation fix X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dgilbert@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Configuring QEMU with: ../configure --cc=3Dclang --enable-rdma Leads to compilation error: CC migration/rdma.o CC migration/block.o qemu/migration/rdma.c:3615:58: error: taking address of packed member 'rk= ey' of class or structure 'RDMARegisterResult' may result in an unaligned pointer value [-Werro= r,-Waddress-of-packed-member] (uintptr_t)host_addr, NULL, ®_result->rkey, ^~~~~~~~~~~~~~~~ Fix it by using a temp local variable. Signed-off-by: Marcel Apfelbaum Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- v1 -> v2:=20 - Use a temp local variable (Dave) migration/rdma.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/migration/rdma.c b/migration/rdma.c index 54a3c11540..e39ee77558 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3611,13 +3611,16 @@ static int qemu_rdma_registration_handle(QEMUFile *= f, void *opaque) } chunk_start =3D ram_chunk_start(block, chunk); chunk_end =3D ram_chunk_end(block, chunk + reg->chunks); + /* avoid "-Waddress-of-packed-member" warning */ + uint32_t tmp_rkey =3D 0; if (qemu_rdma_register_and_get_keys(rdma, block, - (uintptr_t)host_addr, NULL, ®_result->rkey, + (uintptr_t)host_addr, NULL, &tmp_rkey, chunk, chunk_start, chunk_end)) { error_report("cannot get rkey"); ret =3D -EINVAL; goto out; } + reg_result->rkey =3D tmp_rkey; =20 reg_result->host_addr =3D (uintptr_t)block->local_host_add= r; =20 --=20 2.17.1