From nobody Mon Mar 06 09:04:29 2023 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 4PVXhF3kd8z3wdbL; Mon, 6 Mar 2023 09:04:29 +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 4PVXhF3FSRz46vn; Mon, 6 Mar 2023 09:04:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678093469; 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=/Egp5ZTKKWTDM0QIt/Qi69K8COUxNJU8MYK5CPVnkZg=; b=CuXN5q8LpYMYiOTUC/Z7hxF3K3LC4pJkFg2Z5qRcyZJuHfeIqTBHNH+olHcwBkQHpEbmBj MNzS9wIxTOFD8PJ8akOwxObWm5n7+UzXCUsYDxU4IpcIulUIKlv7Hnd6tzQlxMLnw5iure QCwGker1BBL/X5/nqWPG/xcaiXZtms7l0BZ9ftLTMJBVK+ylJj/cUtTd8YAzu9WQifN0UG WAZ1TBF8A4OL7+R00F4GL4AEOm0EO6bCZugwbcZ0Q2X4UTv+rGNpkZp5USkJEGgsaTVrqR cNrfQdoBnONIlA6Cq4/9egq9nNMGbSMmJvPSUttGVrkfXuVqzC+yd4+PJxzY5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678093469; 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=/Egp5ZTKKWTDM0QIt/Qi69K8COUxNJU8MYK5CPVnkZg=; b=Lgv7ZpS0bZ5DhlcdarbZkyQEpJbhXcESXdrt/OizN7XvhD9iRzGnF9GAIAgqNyCxv4yUQ6 2g/Q6Zl4IkHZfFNa3YovVGWwHqoucQI0MOAEDijAV3JtJBZN92L5IYe54y3Seu71hy629X d59yoBOHVC6qYPNpOSXzUO9AmIIUlpAB9fPk7Cs7qzo6VNSTDiwgbP46hsaqVrNPDxKGiw MkD0/mjiqJ5ac2W9dNA1AmiA2JZoa1fhnQiHMzPwFBWSENrRTtG8OOiFZTSfRtMjulaYp1 VvaDluSrnKNs945L5vxbiNu/5hgiebItnLGh1bKMLblrMFvi2O4n+lgEUCIMGg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678093469; a=rsa-sha256; cv=none; b=yKHT6/occsMvU/Xh8GZque7sNVz/8xkH+2KHn5mXUVYbt2N6+oulvEjX8BRZO2baBg3D0j bUBCcM2+rhwXTmuwmUgzoRzzdMRx2DTz/Szv2VaxNOsTQOWdQAD/Ne1yh/BLXQyD4g6llS zlCVoKkiga6bg6x+iYsDXfYrMwlcjyC8SKqMbNMYMd2NN9NlZF7OYT2QlqvFRmtIcQKNkv S04vvFYKSXsOUtRWMy0BtRO5pPenabeDPAlkqmny4RBKRecdLlx63cSH1S+SmNTu1UesBz JmHdEYk0QOmoL45RZNGySKYD0gy3xCBo00ZRJogzlSUqjQO41DrrMBlfhuAGyA== 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 4PVXhF2HbXzwfT; Mon, 6 Mar 2023 09:04:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32694T1b085670; Mon, 6 Mar 2023 09:04:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32694Tgv085669; Mon, 6 Mar 2023 09:04:29 GMT (envelope-from git) Date: Mon, 6 Mar 2023 09:04:29 GMT Message-Id: <202303060904.32694Tgv085669@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: ee10c61d7a0a - main - stress2: Fix a off-by-one error. Added check for argument file type 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ee10c61d7a0ae11a9d76c54a393587bd3933698e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=ee10c61d7a0ae11a9d76c54a393587bd3933698e commit ee10c61d7a0ae11a9d76c54a393587bd3933698e Author: Peter Holm AuthorDate: 2023-03-06 09:03:43 +0000 Commit: Peter Holm CommitDate: 2023-03-06 09:03:43 +0000 stress2: Fix a off-by-one error. Added check for argument file type --- tools/test/stress2/tools/flip.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/test/stress2/tools/flip.c b/tools/test/stress2/tools/flip.c index 8d01e9d78ea1..d73212c748bf 100644 --- a/tools/test/stress2/tools/flip.c +++ b/tools/test/stress2/tools/flip.c @@ -57,7 +57,7 @@ flip(void *ap, size_t len) unsigned char bit, buf, mask, old __unused; cp = (unsigned char *)ap; - byte = random_long(0, len); + byte = random_long(0, len - 1); bit = random_long(0,7); mask = ~(1 << bit); buf = cp[byte]; @@ -111,6 +111,8 @@ main(int argc, char *argv[]) if (size == 0) { if (fstat(fd, &st) == -1) err(1, "stat %s", argv[0]); + if ((st.st_mode & S_IFREG) == 0) + errx(1, "%s must be a regular file\n", argv[0]); size = st.st_size; }