git: d71830cdf0df - main - ktls: Use ATF_REQUIRE instead of assert() for validating TLS header lengths.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 16 Nov 2021 17:56:27 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d71830cdf0df6dbc4bd3332daa95d9ecd7d64060 commit d71830cdf0df6dbc4bd3332daa95d9ecd7d64060 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2021-11-16 17:56:15 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2021-11-16 17:56:15 +0000 ktls: Use ATF_REQUIRE instead of assert() for validating TLS header lengths. The TLS header length field is set by the kernel, so if it is incorrect that is an indication of a kernel bug, not an internal error in the tests. Prompted by: markj (comment in an earlier review) Reviewed by: markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D33003 --- tests/sys/kern/ktls_test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/sys/kern/ktls_test.c b/tests/sys/kern/ktls_test.c index 21e3213a8634..64e26bb27f37 100644 --- a/tests/sys/kern/ktls_test.c +++ b/tests/sys/kern/ktls_test.c @@ -913,8 +913,8 @@ test_ktls_transmit_app_data(struct tls_enable *en, uint64_t seqno, size_t len) record_len = sizeof(struct tls_record_layer) + ntohs(hdr->tls_length); - assert(record_len <= outbuf_cap); - assert(record_len > outbuf_len); + ATF_REQUIRE(record_len <= outbuf_cap); + ATF_REQUIRE(record_len > outbuf_len); rv = read(ev.ident, outbuf + outbuf_len, record_len - outbuf_len); if (rv == -1 && errno == EAGAIN) @@ -1013,7 +1013,7 @@ test_ktls_transmit_control(struct tls_enable *en, uint64_t seqno, uint8_t type, ATF_REQUIRE(rv == sizeof(struct tls_record_layer)); payload_len = ntohs(hdr->tls_length); record_len = payload_len + sizeof(struct tls_record_layer); - assert(record_len <= outbuf_cap); + ATF_REQUIRE(record_len <= outbuf_cap); rv = read(sockets[0], outbuf + sizeof(struct tls_record_layer), payload_len); ATF_REQUIRE(rv == (ssize_t)payload_len);