From nobody Mon Jan 20 16:52:23 2025 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 4YcGbX0m69z5kM2M; Mon, 20 Jan 2025 16:52:24 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YcGbW3ycMz3Wxp; Mon, 20 Jan 2025 16:52:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737391943; 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=6B/8Y2XY1bbGTWc0c3t/lqmWrFN7XW3qH+whYFxMGPk=; b=Ys8ftwwBLz0XSHot1CTlVK7/hwCKMgeBDxlExTPUiwnhH8yQRozsowl/Kc6ZLsF61yBboW WRPciu7hRsgxd37fYWvsCBc2fbzAmqA9ZNpJKt/1V/2tGyYtx/bG0vCgQIQBO4ULl9kdIW L9YpJxIRVN7qijVWZGJ+TNSgdYQRkCBA5BOz6Ii+p4wQIPc8XiP38eBNfyIVv49PdFicwN nisLMYgHOLB+WxG4L8KwOMXLTUfdCMiyZ+vc38lxChv6lHBCSGAdfQXlm2+8c89ySkOX3C hfOvLzTEFD2GdgoyuiQuDQYcfTTd9OLqF1nHoK8PccMVtyGr7Z23n7yO6XQd0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737391943; 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=6B/8Y2XY1bbGTWc0c3t/lqmWrFN7XW3qH+whYFxMGPk=; b=oTjvDHmqKxKxWsHXaT8UDdJKS+jKoHhITDx4QB96CAlq6Il+/ylWCBoBEyD3bdmvI07/e/ 4PnHQDDcJMzdwfMEePHLKz3Ybs/5l/3H+9aKk2zS8F401JAnJKcwLn/noNOTgX037Uqwak pKOpcJpfR2LLRF3TV6LPRgF1FkqRCO5Jr/mt+L3lkxCTEzvRrP/7YszpaSB+zZjzVAH4lJ C77UF2l5Nub0g+cFP7kvb7kl3ebEhfpoErQP2R0ij1KhDuez9uWKWTArsj67rGUxGcsk0x LxcnS0a7AhH3UUaNyRAef32NqHDmgxn2LocqZ3In4gIsvYwLM2HgxbeH6sAJkw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737391943; a=rsa-sha256; cv=none; b=dd0Ow8VP4c0y69eErQuDIe+LBTBUg8lYkVgmrSM19ng3TgvRLretzauqRUcSoGfKKBPf+D eay1zJT055X1+NAKzlWFN9tJl/ZoI2+0Bj9yYtv/VDpsT2fQh9Stz9693AuaNXg/LcjD5V dN51uj3CTt/2Fo8onbXHJ2Li80OkHxG3XFIjaCxi2uZWN0zWQ5WNnHh/JOhdUNbhCSXCI2 Do510dkF+Xkn70QWbR1Yd9cLiSMM/dWatllPBCXAJIsukp+RlcELhZAZsPrsEt9hwqo7Me nQQcHdzt01Zc9u0G40czgxYGQ1PqJxxQXsDtvRVdR20wju8CzKlGuMM81y+mWQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcGbW2z9fzCxr; Mon, 20 Jan 2025 16:52:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50KGqNJN067387; Mon, 20 Jan 2025 16:52:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KGqNvN067384; Mon, 20 Jan 2025 16:52:23 GMT (envelope-from git) Date: Mon, 20 Jan 2025 16:52:23 GMT Message-Id: <202501201652.50KGqNvN067384@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 09df42f1d592 - stable/14 - fusefs: Coverity cleanup in the lseek tests 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: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 09df42f1d5925a81c76da163f0f6d647129729c6 Auto-Submitted: auto-generated The branch stable/14 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=09df42f1d5925a81c76da163f0f6d647129729c6 commit 09df42f1d5925a81c76da163f0f6d647129729c6 Author: Alan Somers AuthorDate: 2025-01-06 19:21:29 +0000 Commit: Alan Somers CommitDate: 2025-01-20 16:51:52 +0000 fusefs: Coverity cleanup in the lseek tests Always check the return value of open(). Reported by: Coverity Scan CID: 1471118 1471133 1471215 1471896 1471901 1472116 1473799 CID: 1473879 1473996 1555269 1558044 Sponsored by: ConnectWise (cherry picked from commit f415b2ef30f7bf0db753f09fbba7b0910475b0d2) --- tests/sys/fs/fusefs/lseek.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/sys/fs/fusefs/lseek.cc b/tests/sys/fs/fusefs/lseek.cc index 2a1cb198bcce..12d41f7af1b2 100644 --- a/tests/sys/fs/fusefs/lseek.cc +++ b/tests/sys/fs/fusefs/lseek.cc @@ -71,6 +71,7 @@ TEST_F(LseekPathconf, already_enosys) ).WillOnce(Invoke(ReturnErrno(ENOSYS))); fd = open(FULLPATH, O_RDONLY); + ASSERT_LE(0, fd); EXPECT_EQ(offset_in, lseek(fd, offset_in, SEEK_DATA)); EXPECT_EQ(-1, fpathconf(fd, _PC_MIN_HOLE_SIZE)); @@ -105,6 +106,7 @@ TEST_F(LseekPathconf, already_seeked) out.body.lseek.offset = i.body.lseek.offset; }))); fd = open(FULLPATH, O_RDONLY); + ASSERT_LE(0, fd); EXPECT_EQ(offset, lseek(fd, offset, SEEK_DATA)); EXPECT_EQ(1, fpathconf(fd, _PC_MIN_HOLE_SIZE)); @@ -171,6 +173,7 @@ TEST_F(LseekPathconf, eio) .WillRepeatedly(Invoke(ReturnErrno(EIO))); fd = open(FULLPATH, O_RDONLY); + ASSERT_LE(0, fd); EXPECT_EQ(-1, fpathconf(fd, _PC_MIN_HOLE_SIZE)); EXPECT_EQ(EIO, errno); @@ -203,6 +206,7 @@ TEST_F(LseekPathconf, enosys_now) ).WillOnce(Invoke(ReturnErrno(ENOSYS))); fd = open(FULLPATH, O_RDONLY); + ASSERT_LE(0, fd); EXPECT_EQ(-1, fpathconf(fd, _PC_MIN_HOLE_SIZE)); EXPECT_EQ(EINVAL, errno); @@ -266,6 +270,7 @@ TEST_F(LseekPathconf, seek_now) }))); fd = open(FULLPATH, O_RDONLY); + ASSERT_LE(0, fd); EXPECT_EQ(offset_initial, lseek(fd, offset_initial, SEEK_SET)); EXPECT_EQ(1, fpathconf(fd, _PC_MIN_HOLE_SIZE)); /* And check that the file pointer hasn't changed */ @@ -299,6 +304,7 @@ TEST_F(LseekPathconf, zerolength) ).WillOnce(Invoke(ReturnErrno(ENXIO))); fd = open(FULLPATH, O_RDONLY); + ASSERT_LE(0, fd); EXPECT_EQ(1, fpathconf(fd, _PC_MIN_HOLE_SIZE)); /* Check again, to ensure that the kernel recorded the response */ EXPECT_EQ(1, fpathconf(fd, _PC_MIN_HOLE_SIZE)); @@ -327,6 +333,7 @@ TEST_F(LseekPathconf_7_23, already_enosys) ).Times(0); fd = open(FULLPATH, O_RDONLY); + ASSERT_LE(0, fd); EXPECT_EQ(-1, fpathconf(fd, _PC_MIN_HOLE_SIZE)); EXPECT_EQ(EINVAL, errno); @@ -391,6 +398,7 @@ TEST_F(LseekSeekData, enosys) _) ).WillOnce(Invoke(ReturnErrno(ENOSYS))); fd = open(FULLPATH, O_RDONLY); + ASSERT_LE(0, fd); /* * Default behavior: ENXIO if offset is < 0 or >= fsize, offset @@ -431,6 +439,7 @@ TEST_F(LseekSeekHole, ok) out.body.lseek.offset = offset_out; }))); fd = open(FULLPATH, O_RDONLY); + ASSERT_LE(0, fd); EXPECT_EQ(offset_out, lseek(fd, offset_in, SEEK_HOLE)); EXPECT_EQ(offset_out, lseek(fd, 0, SEEK_CUR)); @@ -463,6 +472,7 @@ TEST_F(LseekSeekHole, enosys) _) ).WillOnce(Invoke(ReturnErrno(ENOSYS))); fd = open(FULLPATH, O_RDONLY); + ASSERT_LE(0, fd); /* * Default behavior: ENXIO if offset is < 0 or >= fsize, fsize @@ -500,6 +510,7 @@ TEST_F(LseekSeekHole, enxio) _) ).WillOnce(Invoke(ReturnErrno(ENXIO))); fd = open(FULLPATH, O_RDONLY); + ASSERT_LE(0, fd); EXPECT_EQ(-1, lseek(fd, offset_in, SEEK_HOLE)); EXPECT_EQ(ENXIO, errno);