From patchwork Sat Jan 12 15:02:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcel Apfelbaum X-Patchwork-Id: 10760997 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3C6306C2 for ; Sat, 12 Jan 2019 15:05:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BBFB29263 for ; Sat, 12 Jan 2019 15:05:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2008A29473; Sat, 12 Jan 2019 15:05:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B3E1A29263 for ; Sat, 12 Jan 2019 15:05:53 +0000 (UTC) Received: from localhost ([127.0.0.1]:55866 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1giKrB-0005sD-37 for patchwork-qemu-devel@patchwork.kernel.org; Sat, 12 Jan 2019 10:05:53 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54428) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1giKo2-0003n9-BN for qemu-devel@nongnu.org; Sat, 12 Jan 2019 10:02:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1giKo1-0002sl-Cl for qemu-devel@nongnu.org; Sat, 12 Jan 2019 10:02:38 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:44168) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1giKo1-0002pj-5O; Sat, 12 Jan 2019 10:02:37 -0500 Received: by mail-wr1-x443.google.com with SMTP id z5so18193834wrt.11; Sat, 12 Jan 2019 07:02:31 -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:in-reply-to:references; bh=nZZl+vB0VqGlKcSyYzqyk0hdM8SZnBVk6joA3EBQ/bc=; b=Slgs+G/yxRwmRrnTOucB0x/bWxEQKHnyZzJnG+H+FqJC7/FvKaF4qy+hJ6wac2oDCM J04jpqXRAO4pFtZ2I9kZuJ0yG/f1wXw0fN1lodEuTyWQYn3S4Orsb+pgGP/xEB48igCX djOqnifVeHp97cz7dOqye+JqJA4/6JopRYh7Jcn4QA6YDPkWM9/LfXZuMU/evMNOXxKJ 3OZgeWpTBqz0nVtK6ffOnQqzIgv4PwaO0/uGATuN4kvKDjGQ3Xv/zLFm6iKVuf2In3P5 9/hyAMgWBda8ZEtK24VfNadnJzIpiyM/nrsDbksgdpyMjKm+3hYpOcb6H60LGmVdmGaL N0ZQ== 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:in-reply-to :references; bh=nZZl+vB0VqGlKcSyYzqyk0hdM8SZnBVk6joA3EBQ/bc=; b=IAtyj6OwtmUTHZxaS9VDW0s8Zif8iKzowMxnT6K7Q5apOm56BoeuMWCyi1YyeRo5Lv A/+NXt6FlbwAmgvvmWV4dcuO6Fwh7z+rwEGf9H8skSHFalBP7WO4KNsA9UtaXtdnE8vk hWbnbsJqHcdV4s61xCXh8Tm+DMxrRM+R1uRkNgX5AABkpkTiSXxdfGhNPk6hSGN4bQWg hsdjMFG+8uQGf6tUi1tHtrQHtSWb2h+Nyg6AzbZrkmFCPePa6BopAmEgwzJiUrT8Zr5U J0kDzcurNZFN3bkekNmXTaOh/dLb9U5npR9qGp3aBTcAE6YEUlRUrDwn2e+NtRjY5sfr mlNw== X-Gm-Message-State: AJcUukenu5hlctwZTA0vyaz63K0bi1ayizCcc3/8CHDAy+LGX7z7IN9U 8tqbtaDVjUAKR0x7wu3sUQkCxb9+ X-Google-Smtp-Source: ALg8bN7M1MQBXAoZzmNOTlm/JT9s0EAYrQXERg1IrCvtfw3RXbuvTJi/O5SjyQ2UwCL5A+hgrxJgXg== X-Received: by 2002:a5d:558a:: with SMTP id i10mr17050102wrv.287.1547305350712; Sat, 12 Jan 2019 07:02:30 -0800 (PST) Received: from localhost.localdomain ([176.228.155.165]) by smtp.gmail.com with ESMTPSA id o81sm38222581wmd.10.2019.01.12.07.02.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 12 Jan 2019 07:02:30 -0800 (PST) From: Marcel Apfelbaum To: qemu-devel@nongnu.org Date: Sat, 12 Jan 2019 17:02:24 +0200 Message-Id: <20190112150225.20294-3-marcel.apfelbaum@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190112150225.20294-1-marcel.apfelbaum@gmail.com> References: <20190112150225.20294-1-marcel.apfelbaum@gmail.com> 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 2/3] hw/rdma: modify struct initialization 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: cohuck@redhat.com, qemu-stable@nongnu.org, yuval.shaia@oracle.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Do not initialize structs with {0} since some CLANG versions do not support it. Use memset instead. Signed-off-by: Marcel Apfelbaum Reviewed-by: Yuval Shaia --- contrib/rdmacm-mux/main.c | 12 +++++++++--- hw/rdma/rdma_backend.c | 16 ++++++++++++---- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/contrib/rdmacm-mux/main.c b/contrib/rdmacm-mux/main.c index 64676030c5..d01dc76927 100644 --- a/contrib/rdmacm-mux/main.c +++ b/contrib/rdmacm-mux/main.c @@ -350,9 +350,11 @@ static int get_fd(const char *mad, int *fd, __be64 *gid_ifid) static void *umad_recv_thread_func(void *args) { int rc; - RdmaCmMuxMsg msg = {0}; + RdmaCmMuxMsg msg; int fd = -2; + memset(&msg, 0, sizeof(msg)); + msg.hdr.msg_type = RDMACM_MUX_MSG_TYPE_REQ; msg.hdr.op_code = RDMACM_MUX_OP_CODE_MAD; @@ -387,11 +389,13 @@ static void *umad_recv_thread_func(void *args) static int read_and_process(int fd) { int rc; - RdmaCmMuxMsg msg = {0}; + RdmaCmMuxMsg msg; struct umad_hdr *hdr; uint32_t *comm_id = 0; uint16_t attr_id; + memset(&msg, 0, sizeof(msg)); + rc = recv(fd, &msg, sizeof(msg), 0); syslog(LOG_DEBUG, "Socket %d, recv %d\n", fd, rc); @@ -744,7 +748,9 @@ static void signal_handler(int sig, siginfo_t *siginfo, void *context) static int init(void) { int rc; - struct sigaction sig = {0}; + struct sigaction sig; + + memset(&sig, 0, sizeof(sig)); rc = init_listener(); if (rc) { diff --git a/hw/rdma/rdma_backend.c b/hw/rdma/rdma_backend.c index c28bfbd44d..92e95aa640 100644 --- a/hw/rdma/rdma_backend.c +++ b/hw/rdma/rdma_backend.c @@ -190,9 +190,11 @@ static inline int rdmacm_mux_can_process_async(RdmaBackendDev *backend_dev) static int check_mux_op_status(CharBackend *mad_chr_be) { - RdmaCmMuxMsg msg = {0}; + RdmaCmMuxMsg msg; int ret; + memset(&msg, 0, sizeof(msg)); + pr_dbg("Reading response\n"); ret = qemu_chr_fe_read_all(mad_chr_be, (uint8_t *)&msg, sizeof(msg)); if (ret != sizeof(msg)) { @@ -387,10 +389,12 @@ static int build_host_sge_array(RdmaDeviceResources *rdma_dev_res, static int mad_send(RdmaBackendDev *backend_dev, uint8_t sgid_idx, union ibv_gid *sgid, struct ibv_sge *sge, uint32_t num_sge) { - RdmaCmMuxMsg msg = {0}; + RdmaCmMuxMsg msg; char *hdr, *data; int ret; + memset(&msg, 0, sizeof(msg)); + pr_dbg("num_sge=%d\n", num_sge); if (num_sge != 2) { @@ -1112,9 +1116,11 @@ int rdma_backend_get_gid_index(RdmaBackendDev *backend_dev, int rdma_backend_add_gid(RdmaBackendDev *backend_dev, const char *ifname, union ibv_gid *gid) { - RdmaCmMuxMsg msg = {0}; + RdmaCmMuxMsg msg; int ret; + memset(&msg, 0, sizeof(msg)); + pr_dbg("0x%llx, 0x%llx\n", (long long unsigned int)be64_to_cpu(gid->global.subnet_prefix), (long long unsigned int)be64_to_cpu(gid->global.interface_id)); @@ -1138,9 +1144,11 @@ int rdma_backend_add_gid(RdmaBackendDev *backend_dev, const char *ifname, int rdma_backend_del_gid(RdmaBackendDev *backend_dev, const char *ifname, union ibv_gid *gid) { - RdmaCmMuxMsg msg = {0}; + RdmaCmMuxMsg msg; int ret; + memset(&msg, 0, sizeof(msg)); + pr_dbg("0x%llx, 0x%llx\n", (long long unsigned int)be64_to_cpu(gid->global.subnet_prefix), (long long unsigned int)be64_to_cpu(gid->global.interface_id));