From patchwork Fri Oct 6 23:49:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 9990743 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B558860364 for ; Fri, 6 Oct 2017 23:53:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A594326E40 for ; Fri, 6 Oct 2017 23:53:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95A9228DC8; Fri, 6 Oct 2017 23:53:46 +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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A03C26E40 for ; Fri, 6 Oct 2017 23:53:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752339AbdJFXxn (ORCPT ); Fri, 6 Oct 2017 19:53:43 -0400 Received: from mail-qk0-f196.google.com ([209.85.220.196]:33919 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751485AbdJFXxm (ORCPT ); Fri, 6 Oct 2017 19:53:42 -0400 Received: by mail-qk0-f196.google.com with SMTP id b124so10272769qke.1 for ; Fri, 06 Oct 2017 16:53:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ykI4tnSUBkLz8hzKxB9N2iyqvP6oAmt1ciyJeGB7v/c=; b=HHja9FQXhlZibjKWra5LZLQX77bxC4ibNNhZcp7+2PYtTyz+bBH0m48juFGUEssayT AaT0IcXlysGlxe3vVUUwwYLwWgjYFpyR2Hi1RuFKjUw9XVPIAu61i8GIsztQOwq/WhoQ 5h5jsP/kDLVT0n2DX6b5ztpDoKQeyR+x24thQ4CSOF9hTzprfrAzLrzLofwajoIX51Wf wKOo5aPHh+nX60N5F3bpaL+ie5xfjSetIlcN/jsUTxZeEK60ko1sATYzU9XXR+muZVMl q6U75Sg8wk3WT78bWtmi6nKCfYiU1gnn7XSyGnlGskLLVCWS3Z/4E3m9KSenX3l6sUTm g8Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ykI4tnSUBkLz8hzKxB9N2iyqvP6oAmt1ciyJeGB7v/c=; b=mwQJ+QEkpOdm7qGOvCWt++yySdkgZo1edMXijbDr2LLG2CKhDSpQOuDKRa1TRJczxW 9DjAooPaQASK5mavB/PfmXVf6cgzhA0g27kWewuRiGmXU/J9wa3CxxYmgO+VrqOe/NDx DbBDmJSZ9CGFqMk07JS2bBQfyTNcUhB7NIl93cULdn3aMkcImWLW7mPizQI2AP126zjG LayK/gGB2ZHaYZ7GrNIqevtFaC+2NJG57WhgsBRwl8K3sB5i5IEGZ+p1uuOvDSe5jFxS FzSOA0XKNeny8kP/KlGuxZ4emTwkCYkhTcQVN0nojE/7FaP1Y/GFlQXqKWURGqSpk98e bRLw== X-Gm-Message-State: AMCzsaWVQBQjfz7Gei46iWEHcM3isXdblvDD2bLl1ELviQj33QG9nZC0 piGKMGys2c9qDheH2AYCq2s= X-Google-Smtp-Source: AOwi7QCvdc2uq3J7s9Hd6sA1uqX4omoq3y9CsqJMIAw18FRnMociFrs+lDfNsU2t0gqKJ3GeKCsu9Q== X-Received: by 10.55.91.69 with SMTP id p66mr694664qkb.167.1507334021939; Fri, 06 Oct 2017 16:53:41 -0700 (PDT) Received: from yoga.lan ([181.93.89.178]) by smtp.gmail.com with ESMTPSA id g1sm1705226qta.95.2017.10.06.16.53.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Oct 2017 16:53:41 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Blake , Paolo Bonzini , kvm@vger.kernel.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , qemu-devel@nongnu.org, Kevin Wolf , qemu trival , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 54/88] KVM: use g_new() family of functions Date: Fri, 6 Oct 2017 20:49:49 -0300 Message-Id: <20171006235023.11952-55-f4bug@amsat.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171006235023.11952-1-f4bug@amsat.org> References: <20171006235023.11952-1-f4bug@amsat.org> MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marc-André Lureau Signed-off-by: Marc-André Lureau Signed-off-by: Philippe Mathieu-Daudé [PMD: more changes] Reviewed-by: Gabriel Somlo --- accel/kvm/kvm-all.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 90c88b517d..12568d703c 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -278,7 +278,7 @@ int kvm_destroy_vcpu(CPUState *cpu) goto err; } - vcpu = g_malloc0(sizeof(*vcpu)); + vcpu = g_new0(struct KVMParkedVcpu, 1); vcpu->vcpu_id = kvm_arch_vcpu_id(cpu); vcpu->kvm_fd = cpu->kvm_fd; QLIST_INSERT_HEAD(&kvm_state->kvm_parked_vcpus, vcpu, node); @@ -865,7 +865,7 @@ void kvm_memory_listener_register(KVMState *s, KVMMemoryListener *kml, { int i; - kml->slots = g_malloc0(s->nr_slots * sizeof(KVMSlot)); + kml->slots = g_new0(KVMSlot, s->nr_slots); kml->as_id = as_id; for (i = 0; i < s->nr_slots; i++) { @@ -1129,7 +1129,7 @@ int kvm_irqchip_send_msi(KVMState *s, MSIMessage msg) return virq; } - route = g_malloc0(sizeof(KVMMSIRoute)); + route = g_new0(KVMMSIRoute, 1); route->kroute.gsi = virq; route->kroute.type = KVM_IRQ_ROUTING_MSI; route->kroute.flags = 0; @@ -2243,7 +2243,7 @@ int kvm_insert_breakpoint(CPUState *cpu, target_ulong addr, return 0; } - bp = g_malloc(sizeof(struct kvm_sw_breakpoint)); + bp = g_new(struct kvm_sw_breakpoint, 1); bp->pc = addr; bp->use_count = 1; err = kvm_arch_insert_sw_breakpoint(cpu, bp);