From nobody Mon Jan 06 19:30:34 2025 X-Original-To: dev-commits-src-main@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 4YRkmW1vb3z5k5Bb; Mon, 06 Jan 2025 19:30:35 +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 4YRkmW1DFxz4R4N; Mon, 6 Jan 2025 19:30:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736191835; 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=L5w5Ods4SSwZV4mL5o/yWtaBs/rQgH0q2QClU54jMc0=; b=YWO20CQ12NqywzweO2/0aOR4ITBz1gGH3Nf9gEdIWW/vLcLwZP22CYCBNgmtp0PaEPrvSB cJGU75scGwsDyH11cvbh4WReZ/W/AIOl9+EFGp6VprVPws4xJOM6OaB0zodfr/5bfmbt4L jyAUD/gzTNWOwLXMmp6JPoGSZtlnK4NWBxYezKLN7ArVy3SLAd7AG4TF0xY3SqDauh+hak UV1723Kgjr5yTJxqjMQqQQOgJS4tCvRwdp/6EiIhEWbVsTzvb+bWLrErzOsBAGPh+CqKrd PrO0JDDviKFxNM7KffaV2oj+THBZgo0QFgxGCOcyIR0/Wn910mG3niH61yCaSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736191835; 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=L5w5Ods4SSwZV4mL5o/yWtaBs/rQgH0q2QClU54jMc0=; b=wnE9IwcSuyoEqKjNETHhR6/05hWXWBSBzfX5LLfUqGf7MyOgKCtZfw+45iR7hC4KF633Tp Km061tif7H/SI3tog2MsWgsitWVZ4x9H6yaXG2OXzPTWhLxFItsl+VIOwogYweFfSIHDmw /cnb5n9Ro5Xue+9fQ5Twnpu9Fpc9rqSjxyDUOCdMKa0ekgJ073T/A7ixcMFD3HZ9X6Vted axbNUoG9B+0QfCmH4ePteMlm9bZIFCPm3dlBWDl1C5Irxyhb+aL/ZGRz9rxhmygsMvTCzT S9oGM5N4mivv7wHn3Q3/G4NIUAC43VoUfrRYTrKcPhuMmytRqcmLo+R3FD4n9A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736191835; a=rsa-sha256; cv=none; b=c2x1nun0sE1bs+m86mVo77Q+heUS8d8KghfQG8Rz+6GoBn8TJGps2rEjGf3Gu9+qm8fGAo Wefp35Ci0acGFt4T4Yfs9xqR/u335FZgDnBPWGqc1gEKmjEHNZ4rUDBE93Vu8vBZgVb75U 3Wa42oZ1Sm/BnHzzCd1CIIn79ZgrUR0I695Q6fzfMPqPwCnJc8q9DguVEeMwWwsWWHgQoC nIR6QgU5mCt8SH7wd4YkiPaEnVNK0G1TjacK23TLJBDbGd4cYvP3CKFaHByBiUbsqTswNm R6sGfhucfFj/P18/039iYmt1jBr9umjOrHCEl3WTY4IwoliD0iIjwNSLBlrwzQ== 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 4YRkmW0MNVzdnY; Mon, 06 Jan 2025 19:30:35 +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 506JUY1q067720; Mon, 6 Jan 2025 19:30:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 506JUYY2067717; Mon, 6 Jan 2025 19:30:34 GMT (envelope-from git) Date: Mon, 6 Jan 2025 19:30:34 GMT Message-Id: <202501061930.506JUYY2067717@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: f415b2ef30f7 - main - fusefs: Coverity cleanup in the lseek tests List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: f415b2ef30f7bf0db753f09fbba7b0910475b0d2 Auto-Submitted: auto-generated The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=f415b2ef30f7bf0db753f09fbba7b0910475b0d2 commit f415b2ef30f7bf0db753f09fbba7b0910475b0d2 Author: Alan Somers AuthorDate: 2025-01-06 19:21:29 +0000 Commit: Alan Somers CommitDate: 2025-01-06 19:30:16 +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 MFC after: 2 weeks Sponsored by: ConnectWise --- 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);