From nobody Mon Feb 9 15:46:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1629814317; cv=none; d=zohomail.com; s=zohoarc; b=OM4UXIoaskgl0+OayYvdCxfMHvIjq/W1CeFhjB7Zd55ktdjTwUUnNCZw5zx7K2Ipj4fvr1sPuqn1Hv0QRU7dI908VUAuMaiUAbPlF0a4V7Ije9bVkOFLCag8Da5YYdw47RAVmkuAIvSAu3ywA9KfwehDabQoD9zXny2XBTQGUdw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629814317; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=wErq8/MJBqeGe7FrwWidBXlks9jtibqyP3ZzK8xaUyQ=; b=c8ysrQbVanZk9n4bqq9aMR2iqHwnbb1LjT/cZ93yVZC8EO+FL9nZ5nehs0bIU/rCGO+CAOEc2OK82XIu+RKsCbJEA8YCWja60gtUpny4zIypM7P759XfSFoh0ouG0Atp5A8dEHlFDwf8eUGzbMOLX4+/jMs88yfnW6UIDDukvEw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1629814317800705.1447127645889; Tue, 24 Aug 2021 07:11:57 -0700 (PDT) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-169-HHC1jPgZMH2ph0QdvaY3_g-1; Tue, 24 Aug 2021 10:11:55 -0400 Received: by mail-wr1-f70.google.com with SMTP id b7-20020a5d4d87000000b001575d1053d2so935507wru.23 for ; Tue, 24 Aug 2021 07:11:54 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (163.red-83-52-55.dynamicip.rima-tde.net. [83.52.55.163]) by smtp.gmail.com with ESMTPSA id f18sm2492249wmc.6.2021.08.24.07.11.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Aug 2021 07:11:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629814316; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wErq8/MJBqeGe7FrwWidBXlks9jtibqyP3ZzK8xaUyQ=; b=GyBOSfeRoMUX3YCmnMyVE/eYY2HuHmW4MD68OLVvh2wWqMm+yYXAQqA7IRFIZYByBygrNl LdXUN6Q3+IYIBUdsIR5u5C64LKTcAjgOERkgCy/RMddGC016b0Dr7qPriNMBtNiklF7joN U2jLqUYeJ2DUUdh7ZEPBV0cvq1Rg2fo= X-MC-Unique: HHC1jPgZMH2ph0QdvaY3_g-1 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:mime-version:content-transfer-encoding; bh=wErq8/MJBqeGe7FrwWidBXlks9jtibqyP3ZzK8xaUyQ=; b=eIJnraxbIxo21XmRPosyzUVgmihsLUTZD0m/UnJivjWWrrSVt+jBFYkWItcxLRvjPN /AywnU8cm7si5LqkTeaDTHCvAXoDDM4jnaxm9MM0bdE5ldY0Dtx7WcCwFQQJVUdByJIa 5a0XcITtNl7CMjbdMwwi2T742fxxPMsRLmD8mIWn15y/q+B0hKI0Xpv3qeUewhmxmEE0 og+y5H01cPzn+0OzDPoiqyqywNguWAxmB+tY37J88LVfDRZfFb90Qdh2Kp6Ex+UG2Uz6 6K4TETiTjOq0JCDoiz7jtqursUAgTtThY61eVW6rV9sW7iOZb7UMUOzXMBZyI3UhU+CU xGvQ== X-Gm-Message-State: AOAM533sN7Fy+p9s8WlLDFTH1jZyYc/JTpJs5KHiwQAH1cgNn4ln64NL 1SBqKNJNA1S8U695lecgHBEumwJ/TXnssaoLMx3nyxRKObyYHJuGyN/A7icshxkZBJY9KFdrsLH /NbCKiU8H4zHU7w== X-Received: by 2002:a1c:4c13:: with SMTP id z19mr4309490wmf.132.1629814313945; Tue, 24 Aug 2021 07:11:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8AA5sxjyDrxXS0sY56cNGPL06ePlxg6uRN1Z6eGVLHV4CVS10/SuDdUnWhWD+ZnLRsBJz0w== X-Received: by 2002:a1c:4c13:: with SMTP id z19mr4309476wmf.132.1629814313802; Tue, 24 Aug 2021 07:11:53 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Auger Eric , Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org, Fam Zheng Subject: [PATCH 2/9] block/nvme: Have nvme_create_queue_pair() report errors consistently Date: Tue, 24 Aug 2021 16:11:35 +0200 Message-Id: <20210824141142.1165291-3-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210824141142.1165291-1-philmd@redhat.com> References: <20210824141142.1165291-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1629814318764100001 nvme_create_queue_pair() does not return a boolean value (indicating eventual error) but a pointer, and is inconsistent in how it fills the error handler. To fulfill callers expectations, always set an error message on failure. Reported-by: Auger Eric Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/nvme.c b/block/nvme.c index e8dbbc23177..6642c104aa4 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -220,6 +220,7 @@ static NVMeQueuePair *nvme_create_queue_pair(BDRVNVMeSt= ate *s, =20 q =3D g_try_new0(NVMeQueuePair, 1); if (!q) { + error_setg(errp, "Cannot allocate queue pair"); return NULL; } trace_nvme_create_queue_pair(idx, q, size, aio_context, @@ -228,6 +229,7 @@ static NVMeQueuePair *nvme_create_queue_pair(BDRVNVMeSt= ate *s, qemu_real_host_page_size); q->prp_list_pages =3D qemu_try_memalign(qemu_real_host_page_size, byte= s); if (!q->prp_list_pages) { + error_setg(errp, "Cannot allocate PRP page list"); goto fail; } memset(q->prp_list_pages, 0, bytes); --=20 2.31.1