From nobody Wed Nov 27 04:55:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1700726251; cv=none; d=zohomail.com; s=zohoarc; b=NX2Kj/vajEMXetXZEIso4DJd8E+EGFRg4r7mTOLBYo8OaA4C1M+yT4YvMuiDI0R9WsdC2tECygsMPHBjfzz1OAo1EKhTRf5AtSozihKO4b+e+JInspMUtAcJlp4k3Q6q4YGf1ZPcQZ01LABLbSB6xWivhXbjJVv9PM2zWWtvil4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1700726251; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:Message-Id:Reply-To:To; bh=R42t0zurSU/voQ0hzGOFli39dvO6lzPv12UhMDveciM=; b=fwwkNljqNk30KYVeYCWCw1lmTlJdTSKScutTab1ue+5lUlyUe9tB0yzAszqJO3Zj3n/LG7rHKnrGtJcSdNAgasq8UWSa49LvjeivGhnvrShzPVS4GSIAd6j0WlVlmFW+mP7WuAeL8Lb54WPo9XhhNbpymUotUPSwSiBdAUHujB4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1700726251593937.9314137234543; Wed, 22 Nov 2023 23:57:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r64Zr-0006NW-77; Thu, 23 Nov 2023 02:56:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r64Zp-0006NJ-QT for qemu-devel@nongnu.org; Thu, 23 Nov 2023 02:56:45 -0500 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r64Zn-0008Qt-NT for qemu-devel@nongnu.org; Thu, 23 Nov 2023 02:56:45 -0500 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1cf6a67e290so4512725ad.1 for ; Wed, 22 Nov 2023 23:56:42 -0800 (PST) Received: from localhost ([157.82.205.15]) by smtp.gmail.com with UTF8SMTPSA id n8-20020a170902e54800b001cf6aae59cbsm701383plf.85.2023.11.22.23.56.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Nov 2023 23:56:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1700726201; x=1701331001; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=R42t0zurSU/voQ0hzGOFli39dvO6lzPv12UhMDveciM=; b=wFKlF+rMxYnODDd22gLsxCqWc3D0eZAEDqBF6ettY6+VA5VgvKE7n2qbdD6gxpC0TE jcPAT7NIzlzzhn3ra9qYWo6QC18he0pOdLjQObNrrWdjH7vy1vJkgcop4oRculyCDIU7 1hYMvtkkamXSTFKsRoOa5dZyXQ16FdiH3tvA/6MeHZEaxq1xp2HSmjdmQUM1OJ1B/lmE BBRdAOQ978hASKqhxsRs4KZqE+OJGygUH1js2XCfY+UnViU0+kV+qeh/Z7Vd62mtLJ71 vyzx9Flt1iaJC7f8CfAxzjGQ1aAVYvkupMgZKqOrF8zKYL8cCnTtO9ut4DBAzHMZj7WM MNoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700726201; x=1701331001; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=R42t0zurSU/voQ0hzGOFli39dvO6lzPv12UhMDveciM=; b=oXVmUMtKT5v9WipCOl2h9Onnb2w9QH1NZ5PGkOoeqG355R9N2zIWYlZsFkTC5EKh0E 03cI3zqY/O6rQOLLcKgWlP9uVRpoAJWL8+GaZFnyjfv+VrbSMLDGl2FiGT3tIydWonpl bVu3o0C6yapeTLrUCn/qyucHlNDwaHy1twJFIxn9UejBuY67bq3rkTezSLnrbUR4YjK6 w49tbK2tFS8RfLjGcjjvmDB2e6fnpFqltxseQZYDAud+12hsCOcgDxvLZ16f4X86cz1l EqhFyFrI7FD+w0OTvbMh6dUCq9dHfLDNMgFUVrw+ndaaLXdp6sHh8k85/gIxiujg/lfF sz9Q== X-Gm-Message-State: AOJu0Yx4TX/gGMMJhXNADYddsRFg4MAiQj+3+gAsC7wL4ilRe2ZNhXya UpICgqW1U0Y9iVr/7DORW1WylA== X-Google-Smtp-Source: AGHT+IGS1S1/L0jRCSVNJ7P1eaNQI8AdMMRWfbNl+NxZt2fveenC81oK1TRq/Dy4HFK5/jWd/vqvUA== X-Received: by 2002:a17:902:e84e:b0:1cc:33f1:3f03 with SMTP id t14-20020a170902e84e00b001cc33f13f03mr5354692plg.2.1700726201194; Wed, 22 Nov 2023 23:56:41 -0800 (PST) From: Akihiko Odaki To: Cc: Akihiko Odaki , "Michael S. Tsirkin" , Marcel Apfelbaum , qemu-devel@nongnu.org Subject: [PATCH] pcie_sriov: Remove g_new assertion Date: Thu, 23 Nov 2023 16:56:29 +0900 Message-ID: <20231123075630.12057-1-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=2607:f8b0:4864:20::62b; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x62b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1700726252467100001 Content-Type: text/plain; charset="utf-8" g_new() aborts if the allocation fails so it returns NULL only if the requested allocation size is zero. register_vfs() makes such an allocation if NumVFs is zero so it should not assert that g_new() returns a non-NULL value. Fixes: 7c0fa8dff8 ("pcie: Add support for Single Root I/O Virtualization (S= R/IOV)") Buglink: https://issues.redhat.com/browse/RHEL-17209 Signed-off-by: Akihiko Odaki Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Yanghang Liu --- hw/pci/pcie_sriov.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 5ef8950940..a1fe65f5d8 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -178,7 +178,6 @@ static void register_vfs(PCIDevice *dev) num_vfs =3D pci_get_word(dev->config + sriov_cap + PCI_SRIOV_NUM_VF); =20 dev->exp.sriov_pf.vf =3D g_new(PCIDevice *, num_vfs); - assert(dev->exp.sriov_pf.vf); =20 trace_sriov_register_vfs(dev->name, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), num_vfs); --=20 2.42.1