From patchwork Fri Jul 22 14:17:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 12926531 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FD8FCCA489 for ; Fri, 22 Jul 2022 14:19:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233943AbiGVOS6 (ORCPT ); Fri, 22 Jul 2022 10:18:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233115AbiGVOS5 (ORCPT ); Fri, 22 Jul 2022 10:18:57 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CEE7A6F98 for ; Fri, 22 Jul 2022 07:18:56 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id d8so6678631wrp.6 for ; Fri, 22 Jul 2022 07:18:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LabL9zieDRj0VzUTnSVQxp5Ep3yS8XLutQqUJnE1wfk=; b=JklDJqFjftBTKNNoaqnTOOmvNDD36NuAScKaadfl6iaeWry87wxnq+W9F3sM99VUuu ypMUtvoikqWQsuiHgXSy7FC/VjiJSiAyLCwBBtNd5teG+WCJan94QhTNmStv6GjklUBg 3qzoBgFty9W1QWST/wqE9f0Qv0XBYSSwD57KtmnyBcPLOoy7WgplSVSmji7dDPFMDiw9 kT4FQDMCsHUBamggDcQIHnscC38Vu0U9IMiMRAQNlzyvMSfH4mmTh1cA0sY0Hd8756U4 K75295KXKBHALG8nnj7Rjw6/AXu2QUipCYMebFFGOwC5OwlBXoEMmj9jGplxpUt88RM4 NJ4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LabL9zieDRj0VzUTnSVQxp5Ep3yS8XLutQqUJnE1wfk=; b=mCNQXptcZSJs4xvxRbrLvo99/WXd3yr5gWjZGyKqZQbyUgALwLwr3OGnu/WdhqxhxV ZQpxPD7Y7tXKJJc6kvtXUICKv9Bm2Yjz0LjtpZGFAnWRVd7g6IfN1x4Tg/nu53AtbXtH fAOJiaj1y33pOVQwg1PxWFox4P5ZlSAo94fBye1VNoZAGvyuKuN4UE57aOMEU32zqwY+ 2WTT8XtC40wLfYoeNMLJKpnVVrPCwmJWDF0iRz8nGDd3uCVw0pLQngQcnfI092uPBjvI y9XMI024llW3MMVS2svEacrDjvppq0CUsZR2F6gaAYKSPiXbUriNoVm9UksUbJ9bLPkq N3jQ== X-Gm-Message-State: AJIora+xDmaa+PdJTGQQpdvDC7d+PtzJhWJNeq7EItDykuB9aeN3eeAn kCK3UAn54tLs1zh4jYByCPHs5f9kZo7TZQ== X-Google-Smtp-Source: AGRyM1u+yWlQsWp2hchgGK3q74e8Z8M8KWwH0hSCdkyr3hnAljQ1tDuLseEOAJSKLNG01G3Uv7DwOg== X-Received: by 2002:a05:6000:186e:b0:21d:ac3c:a066 with SMTP id d14-20020a056000186e00b0021dac3ca066mr104572wri.57.1658499534976; Fri, 22 Jul 2022 07:18:54 -0700 (PDT) Received: from localhost.localdomain (cpc92880-cmbg19-2-0-cust679.5-4.cable.virginm.net. [82.27.106.168]) by smtp.gmail.com with ESMTPSA id az28-20020a05600c601c00b003a325bd8517sm6379415wmb.5.2022.07.22.07.18.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 07:18:54 -0700 (PDT) From: Jean-Philippe Brucker To: will@kernel.org Cc: kvm@vger.kernel.org, suzuki.poulose@arm.com, sami.mujawar@arm.com, Jean-Philippe Brucker Subject: [PATCH kvmtool 1/4] Makefile: Add missing build dependencies Date: Fri, 22 Jul 2022 15:17:29 +0100 Message-Id: <20220722141731.64039-2-jean-philippe@linaro.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220722141731.64039-1-jean-philippe@linaro.org> References: <20220722141731.64039-1-jean-philippe@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org When running kvmtool after updating without doing a make clean, one might run into strange issues such as: Warning: Failed init: symbol_init Fatal: Initialisation failed or worse. This happens because symbol.o is not automatically rebuilt after a change of headers, because .symbol.o.d is not in the $(DEPS) variable. So if the layout of struct kvm_config changes, for example, symbols.o that was built for an older version will try to read kvm->vmlinux from the wrong location in struct kvm, and lkvm will die. Add all .d files to $(DEPS). Also include $(STATIC_DEPS) which was previously set but not used. Signed-off-by: Jean-Philippe Brucker Reviewed-by: Alexandru Elisei --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1f9903d8..f0df76f4 100644 --- a/Makefile +++ b/Makefile @@ -383,7 +383,7 @@ comma = , # The dependency file for the current target depfile = $(subst $(comma),_,$(dir $@).$(notdir $@).d) -DEPS := $(foreach obj,$(OBJS),\ +DEPS := $(foreach obj,$(OBJS) $(OBJS_DYNOPT) $(OTHEROBJS) $(GUEST_OBJS),\ $(subst $(comma),_,$(dir $(obj)).$(notdir $(obj)).d)) DEFINES += -D_FILE_OFFSET_BITS=64 @@ -590,6 +590,7 @@ cscope: # Escape redundant work on cleaning up ifneq ($(MAKECMDGOALS),clean) -include $(DEPS) +-include $(STATIC_DEPS) KVMTOOLS-VERSION-FILE: @$(SHELL_PATH) util/KVMTOOLS-VERSION-GEN $(OUTPUT) From patchwork Fri Jul 22 14:17:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 12926532 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5024EC43334 for ; Fri, 22 Jul 2022 14:19:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234350AbiGVOTA (ORCPT ); Fri, 22 Jul 2022 10:19:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229880AbiGVOS5 (ORCPT ); Fri, 22 Jul 2022 10:18:57 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30831A6F8C for ; Fri, 22 Jul 2022 07:18:57 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id n12so6698323wrc.8 for ; Fri, 22 Jul 2022 07:18:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aDNVolYznPQ7gawMVSW+MxEOx+fNulR9KeeWM3fdad8=; b=LQYn1Ea/O7oGvPFHvGR3bWVBj37cXXqYQ/ufN7l+GfoV7kSj4XKVahQhky1ofmYSTK wrL8Cou5VCfCLz8tMz8zkY0ZXZdrqa41LKTVmRHTeVulsqFOu1N9v4tZzuJbsEYtUNeK 94Ia5MxHW2XI6Ghngwu/3+GgbHjF5zSqaEtfSUAka322yJxayUhqufxl5TRYHcrPZkTz MKO4DsOe1oAH5GEWOxIeZBrf1f/UFApv3suFS6vE+WqHc5JonanY2eM9YEjBKX6ffe+O yP1AJ9l6ows0I0QbYzxUVJqWN3nJlIs5oYuJqZ0u4+Z58qygxHQhKzZEp/+/a53IaNvf bbVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aDNVolYznPQ7gawMVSW+MxEOx+fNulR9KeeWM3fdad8=; b=wVih8Mh7y9j57cLLZwyu+OcQgsO0lAjW2DcTNbFDQRN26imCb7BqIk27J5+b2Hekdw 3++UidAsnAC/OxSM+DMfzt/QGi3eBwwQDX6pCJ5gqh7UkKy+OmBcGzJT5ku66sV2/DJ8 0LZ8kgYLhYroxXnp//WOoMti6oF6ELNLS4BCntJJ4xQ/K0qqhoNJu2uYxKXfZ1ndcebX OB/UFZHtEXnYNh5hjDUnpyAY7fbWhtrfW3RndhFAeVyt0CTj1rZeFvXphb529VRkdapU FUH2gGCKi65q5d15pLFmFkunKf0kGaBx/yStIF4cD3lJWwyPvnW9in12M2fqR+G+QLbA taZg== X-Gm-Message-State: AJIora8N6cI3U4pPT4qEGgoBQudFgvTS8+hz5JeGcPdtyw787rqFlq11 3RL/a+jmqrZMVlcI2g70HDOiUw== X-Google-Smtp-Source: AGRyM1vOsPNECwuWez3yZ/ztFYbJebGsxpig0/4/P7Vl630jmmxpEXMKdTwhZhIqwhSkY7KpNoc2lA== X-Received: by 2002:a05:6000:508:b0:21d:4105:caf9 with SMTP id a8-20020a056000050800b0021d4105caf9mr85687wrf.699.1658499535793; Fri, 22 Jul 2022 07:18:55 -0700 (PDT) Received: from localhost.localdomain (cpc92880-cmbg19-2-0-cust679.5-4.cable.virginm.net. [82.27.106.168]) by smtp.gmail.com with ESMTPSA id az28-20020a05600c601c00b003a325bd8517sm6379415wmb.5.2022.07.22.07.18.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 07:18:55 -0700 (PDT) From: Jean-Philippe Brucker To: will@kernel.org Cc: kvm@vger.kernel.org, suzuki.poulose@arm.com, sami.mujawar@arm.com, Jean-Philippe Brucker Subject: [PATCH kvmtool 2/4] Makefile: Fix ARCH override Date: Fri, 22 Jul 2022 15:17:30 +0100 Message-Id: <20220722141731.64039-3-jean-philippe@linaro.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220722141731.64039-1-jean-philippe@linaro.org> References: <20220722141731.64039-1-jean-philippe@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Variables set on the command-line are not overridden by normal assignments. So when passing ARCH=x86_64 on the command-line, build fails: Makefile:227: *** This architecture (x86_64) is not supported in kvmtool. Use the 'override' directive to force the ARCH reassignment. Signed-off-by: Jean-Philippe Brucker Tested-by: Alexandru Elisei Reviewed-by: Alexandru Elisei --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f0df76f4..faae0da2 100644 --- a/Makefile +++ b/Makefile @@ -115,11 +115,11 @@ ARCH ?= $(shell uname -m | sed -e s/i.86/i386/ -e s/ppc.*/powerpc/ \ -e s/riscv64/riscv/ -e s/riscv32/riscv/) ifeq ($(ARCH),i386) - ARCH := x86 + override ARCH = x86 DEFINES += -DCONFIG_X86_32 endif ifeq ($(ARCH),x86_64) - ARCH := x86 + override ARCH = x86 DEFINES += -DCONFIG_X86_64 ARCH_PRE_INIT = x86/init.S endif From patchwork Fri Jul 22 14:17:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 12926533 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F436C433EF for ; Fri, 22 Jul 2022 14:19:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234863AbiGVOTB (ORCPT ); Fri, 22 Jul 2022 10:19:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233520AbiGVOS6 (ORCPT ); Fri, 22 Jul 2022 10:18:58 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC946A026D for ; Fri, 22 Jul 2022 07:18:57 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id m17so6413344wrw.7 for ; Fri, 22 Jul 2022 07:18:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DC2JUNKZSOxMdfBfE8uIWKJNFczY8Th1lgyz9dOaayw=; b=N+qVtDLYKlKN8c/tu7cMDaGJ5YokDsHfmX0bekD/2j/gyJM5gZgaLdg+343hJ5Tx1X lJupCVv/AykVR7CwDW3aCTOppDFL+A8GDDMP+QDoY8hEsRprTlYZmGEf8a0owlRF7RUv /wj/CQOp3C0lm06Idb8KEZ0iGnnM7iKDZPjZFnES/44ryOaLCK88ItiZlVWnevCPVfUE /gWa1wMzA5PA0Mkfb/yFbDW5GRQuxe5JOYm+z9VLbAEONu7NQjnHwnhYD7KWIo+Yxayl J30UID2AU1aPhi3kNHkc5W2G3A69Q/6L9AICvXYyoClDUqRw+STNFkiFfTVbIP6bBvAM +TDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DC2JUNKZSOxMdfBfE8uIWKJNFczY8Th1lgyz9dOaayw=; b=xfe0sVCSHeliuXIteJywatvB4CVc1avNPRyPdPCmmJiSZOFvfuGPEtOM0Z2in8OrgY CiWbVW59XVKqIhXAJK90lBQLbT9Qau75H6ba5lDCrR58QAb5SnOGLp2ddND0iaxal3uG kWXEYoGMkE1dZMRjSVfSi8zvBrBMJZpc1jbuCZTELMkaKwU7/TZUVx8y76Knwzbf/XSM y2cIEKCVJZBw0Zkv8PNmifzVlNbUakkTY7PTTO7hHfW1O5mKsQf8mbZrHASmLGIIbILH eJf+VuiglXiVVy2wT5BPnv2uI8t2BsAD2kkCx8LYDzoiIFGsRGJ80r2hj/F3XUjGd9KV TMyg== X-Gm-Message-State: AJIora/kDiEl8h7loQ9s6LE7NKFFMaVBDy8F5fenW31QwtFqCpW/3RBV 6ncBbKYsWRdJTeHNrF7422+O5Q== X-Google-Smtp-Source: AGRyM1tupCu9k+h+xFwgkDWdBqh0w3qrnO0TsgcoGPqoNhPjGp8dEp25eFc90vKUzzIt6WmyZpdNFw== X-Received: by 2002:a5d:44d1:0:b0:21d:7471:2094 with SMTP id z17-20020a5d44d1000000b0021d74712094mr115868wrr.374.1658499536464; Fri, 22 Jul 2022 07:18:56 -0700 (PDT) Received: from localhost.localdomain (cpc92880-cmbg19-2-0-cust679.5-4.cable.virginm.net. [82.27.106.168]) by smtp.gmail.com with ESMTPSA id az28-20020a05600c601c00b003a325bd8517sm6379415wmb.5.2022.07.22.07.18.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 07:18:56 -0700 (PDT) From: Jean-Philippe Brucker To: will@kernel.org Cc: kvm@vger.kernel.org, suzuki.poulose@arm.com, sami.mujawar@arm.com, Jean-Philippe Brucker Subject: [PATCH kvmtool 3/4] virtio/pci: Deassert IRQ line on ISR read Date: Fri, 22 Jul 2022 15:17:31 +0100 Message-Id: <20220722141731.64039-4-jean-philippe@linaro.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220722141731.64039-1-jean-philippe@linaro.org> References: <20220722141731.64039-1-jean-philippe@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Since commit 2108c86d0623 ("virtio/pci: Signal INTx interrupts as level instead of edge"), virtio uses level-triggered IRQs. Bring the modern device up to date, by deasserting the IRQ line when the guest reads the interrupt status register. Fixes: 3bf79498e6d5 ("virtio: Add support for modern virtio-pci") Reported-by: Sami Mujawar Signed-off-by: Jean-Philippe Brucker --- virtio/pci-modern.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/virtio/pci-modern.c b/virtio/pci-modern.c index 753e95bd..c5b4bc50 100644 --- a/virtio/pci-modern.c +++ b/virtio/pci-modern.c @@ -245,10 +245,7 @@ static bool virtio_pci__isr_read(struct virtio_device *vdev, return false; ioport__write8(data, vpci->isr); - /* - * Interrupts are edge triggered (yes, going against the PCI and virtio - * specs), so no need to deassert the IRQ line. - */ + kvm__irq_line(vpci->kvm, vpci->legacy_irq_line, VIRTIO_IRQ_LOW); vpci->isr = 0; return 0; From patchwork Fri Jul 22 14:17:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 12926534 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A38DC43334 for ; Fri, 22 Jul 2022 14:19:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229880AbiGVOTC (ORCPT ); Fri, 22 Jul 2022 10:19:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233115AbiGVOS7 (ORCPT ); Fri, 22 Jul 2022 10:18:59 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD885A6FA6 for ; Fri, 22 Jul 2022 07:18:58 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id bu1so6686428wrb.9 for ; Fri, 22 Jul 2022 07:18:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+ych4a72iO+NbipKChab6l4Z5fEfmGpcbxKoaHxmwIE=; b=a2KC2NiWwDYkSEgt2E21Bo0NttTjnbSd5PsaCGlMD2EmZ8kgASgPYjA0z1YbJRQR9P M4XSu1nm8ZQtCh1/sVLxS34meCrmkRGmvrEB/3ZgZTyA553TyW6Ekrh7ZJTkPt2cewOD ashs+0sfa+y/0O2IJcSl26HcheL/UCPJphUmI6HlNZ9EmSc39Lv4rfnXsA5pU9nGpmAx zrR90V/jc4c2i6WtF9f8n1zjwG55f0mRiRyButF/WL3REQ5q4uuiRjoAG6gXs6C7mpQ4 NQg54TPYSdZf/EkAe2P0hAhsjiarz6LHZGTSwudwGudYfuomCt1kthwgTAWKOe0WiKPB +9dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+ych4a72iO+NbipKChab6l4Z5fEfmGpcbxKoaHxmwIE=; b=DYlKnOms5GKUcmAiyyEX5zyIkCOysV4e5ta1bnK9HqiNDhQ7FoBgGRUrSdRlvVRZ4A 5d3iJglQSfszdqjQE3HEgp0lLOQv7KXrULkbWI7Agu9RsaMjzgiW59SQ23e6rrxa3FUR 4MMfQ8IlojcYtwA04ly12eH6MoOEHcCCJ8iomlBDihskzsCG7d0DAJWJdkpc+xQ7MXI2 jhcLkxivmK+Axl7xICbsj0+i8m/rwJ5OvI4Po0L+gPyapKvqLd9WnNK5U6XRl7OYvIHF Mk+UcuZjdGV9I05CKmNi0yyuzBYJJjwnJ90j485BodnxIkyh+HEBt25ZFxfzUFgvue0M D1Qw== X-Gm-Message-State: AJIora+jE/FfRfLAO5DrwP8t9hLC7BQdW7YBJNszulDGt4WMwPHnUK/4 8lNnN/wkrPUepoEEIUt+bRxgAA== X-Google-Smtp-Source: AGRyM1tHVUb1lbmsC6om6z4zDcgqwEUXcK8jH3gDASYgwRXkW6qXhu6Z5oQRXrowPEUfuNJWOunxQw== X-Received: by 2002:a5d:6d09:0:b0:21d:9846:259c with SMTP id e9-20020a5d6d09000000b0021d9846259cmr126607wrq.212.1658499537119; Fri, 22 Jul 2022 07:18:57 -0700 (PDT) Received: from localhost.localdomain (cpc92880-cmbg19-2-0-cust679.5-4.cable.virginm.net. [82.27.106.168]) by smtp.gmail.com with ESMTPSA id az28-20020a05600c601c00b003a325bd8517sm6379415wmb.5.2022.07.22.07.18.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 07:18:56 -0700 (PDT) From: Jean-Philippe Brucker To: will@kernel.org Cc: kvm@vger.kernel.org, suzuki.poulose@arm.com, sami.mujawar@arm.com, Jean-Philippe Brucker Subject: [PATCH kvmtool 4/4] virtio/rng: Zero-initialize the device Date: Fri, 22 Jul 2022 15:17:32 +0100 Message-Id: <20220722141731.64039-5-jean-philippe@linaro.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220722141731.64039-1-jean-philippe@linaro.org> References: <20220722141731.64039-1-jean-philippe@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Use calloc() to avoid uninitialized fields in the rng device. Signed-off-by: Jean-Philippe Brucker --- virtio/rng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virtio/rng.c b/virtio/rng.c index f9d607f6..63ab8fce 100644 --- a/virtio/rng.c +++ b/virtio/rng.c @@ -162,7 +162,7 @@ int virtio_rng__init(struct kvm *kvm) if (!kvm->cfg.virtio_rng) return 0; - rdev = malloc(sizeof(*rdev)); + rdev = calloc(1, sizeof(*rdev)); if (rdev == NULL) return -ENOMEM;