From nobody Fri May 10 16:41:41 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VbZQt0zfSz5K2C6; Fri, 10 May 2024 16:41:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VbZQs5B22z44wl; Fri, 10 May 2024 16:41:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715359301; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XB8emx0One0A/8He3JVdyJhYs0FnuUftvRyLkgXHKoQ=; b=j2hNbSW/FAjdPFogtduCe2xcJaGp+OiBwp4jhEzzjSepP4KtiDjUduewl/FAzT/LgPLmEi pCdg6+2s+ktctqM5URd56p5CVbLipkoKsxsfwejtwMF3LHVh16/iBPezJxZ4bOIpdfPIJ1 ZF3CWob49Sq8s81lUYt75NCPPBxrQOcJYxYm3MHmqGpFjaggnAGetshgj1wMLSaHCojFlR bHwDUrM8oYtOwXNwSxzlDf56Soi1AvYqOxuIxx+ivsWm0bQyukDBwzwT4/pWXvUwce7NAh 2YDdoafKtfL2Hr8fDY/PxkqbQkQeJh1E0I4X0HyMUavJOdu7+MAwbN8HrWe9yA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715359301; a=rsa-sha256; cv=none; b=hyz6QxuqAQcvhtJFo1R7/IhoWt3kij6G4IRryAH5QR4t2+Y7RPRzJoTgGUv8/l12pxH+lt D8ENDudzkqYBILzexdePzltaVOokjOemldNrGvgd3MnAh5C0nTjpsubvpyDTXm/MahbgG2 CbrDAeEXJ8eTrQF1G7rSwb3t5gvSVh/qp4aMNs/nyHht5m1mf1cuGyA5LwY8RWpCfoEGB1 XA3V6aK6iTu1QJ8IrPuyziiYXwbUYmlmWtyyCIgQSAWZXvoRKdPpXfSa3W2py+BnkAC8BY vhcJqE5fidNc/lT0bL/ljAg6/TV6eb4qhjXL2GvTPf8Yl+cqZTET8tAU8l5tWA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715359301; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XB8emx0One0A/8He3JVdyJhYs0FnuUftvRyLkgXHKoQ=; b=bfrIIbqLe/g69hR1x39QnfhvTwBKMC6TA+CgyyrkNG62VtOTUFT+oVXEewfJJEbpn0JhiN mjD4cFS3L8wHEkWD1YaHZI3rS1zYKe5ZY2P/Fr7jNrv4mgJEjl4ZZ3HRhgCFJonI4CYEgx 0CjY59ZEk80KsD/uVa8hE7JvdTt85xeQuMO4msCKKXK7ICuFOEemlThcTt0pNvuhdtanPo m3HtbxZDR8UgCFnBikawylKaFoocJQzS+1Pb/bkN90+IjAlgflpUxc4yRLytblsiZ3AlA0 RvlBcaiGtYRaRIBW8PAG5Yk448T6Wl5vrKUABD3G3NgyL9kyZnVU8X5CXfwNwg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VbZQs4p2vzl7m; Fri, 10 May 2024 16:41:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44AGffcR018005; Fri, 10 May 2024 16:41:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44AGffX0018002; Fri, 10 May 2024 16:41:41 GMT (envelope-from git) Date: Fri, 10 May 2024 16:41:41 GMT Message-Id: <202405101641.44AGffX0018002@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 0ac468c7b641 - main - nvmecontrol: Free array of I/O queue pairs on failure to handoff List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0ac468c7b641a1db4ad1435cb7072919ab569c50 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0ac468c7b641a1db4ad1435cb7072919ab569c50 commit 0ac468c7b641a1db4ad1435cb7072919ab569c50 Author: John Baldwin AuthorDate: 2024-05-10 16:04:51 +0000 Commit: John Baldwin CommitDate: 2024-05-10 16:13:21 +0000 nvmecontrol: Free array of I/O queue pairs on failure to handoff This is harmless but cleaner. Reported by: Coverity Scan CID: 1545041,1545049 Sponsored by: Chelsio Communications --- sbin/nvmecontrol/connect.c | 5 ++++- sbin/nvmecontrol/reconnect.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sbin/nvmecontrol/connect.c b/sbin/nvmecontrol/connect.c index afb78725a3c7..14bd0cce1f8f 100644 --- a/sbin/nvmecontrol/connect.c +++ b/sbin/nvmecontrol/connect.c @@ -84,12 +84,15 @@ connect_nvm_controller(enum nvmf_trtype trtype, int adrfam, const char *address, error = connect_nvm_queues(&aparams, trtype, adrfam, address, port, cntlid, subnqn, opt.hostnqn, opt.kato, &admin, io, opt.num_io_queues, opt.queue_size, &cdata); - if (error != 0) + if (error != 0) { + free(io); return (error); + } error = nvmf_handoff_host(admin, opt.num_io_queues, io, &cdata); if (error != 0) { warnc(error, "Failed to handoff queues to kernel"); + free(io); return (EX_IOERR); } free(io); diff --git a/sbin/nvmecontrol/reconnect.c b/sbin/nvmecontrol/reconnect.c index c8a010c038d0..b606409eea90 100644 --- a/sbin/nvmecontrol/reconnect.c +++ b/sbin/nvmecontrol/reconnect.c @@ -85,12 +85,15 @@ reconnect_nvm_controller(int fd, enum nvmf_trtype trtype, int adrfam, error = connect_nvm_queues(&aparams, trtype, adrfam, address, port, rparams.cntlid, rparams.subnqn, opt.hostnqn, opt.kato, &admin, io, opt.num_io_queues, opt.queue_size, &cdata); - if (error != 0) + if (error != 0) { + free(io); return (error); + } error = nvmf_reconnect_host(fd, admin, opt.num_io_queues, io, &cdata); if (error != 0) { warnc(error, "Failed to handoff queues to kernel"); + free(io); return (EX_IOERR); } free(io);