From b60adc34d7bdb6f1a36a8ea45164942ab54e4bbe Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 14 Jun 2022 10:56:35 -0400 Subject: [PATCH] Tests: test_uuid: unchecked return value MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 1490026 Unchecked return value If the function returns an error value, the error value may be mistaken for a normal value. In run_test_lttng_uuid_is_equal(): Value returned from a function is not checked for errors before being used (CWE-252) Reported-by: Coverity Scan Signed-off-by: Jérémie Galarneau Change-Id: Id9558a07ebcc47f5630deed32f5a457ba002bfe6 --- tests/unit/test_uuid.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/unit/test_uuid.cpp b/tests/unit/test_uuid.cpp index 403e1f0ea..07a2f4afb 100644 --- a/tests/unit/test_uuid.cpp +++ b/tests/unit/test_uuid.cpp @@ -108,12 +108,15 @@ void run_test_lttng_uuid_is_equal(void) int ret; lttng_uuid uuid1, uuid2; - lttng_uuid_from_str(valid_str_1, uuid1); - lttng_uuid_from_str(valid_str_1, uuid2); + ret = lttng_uuid_from_str(valid_str_1, uuid1); + assert(ret == 0); + ret = lttng_uuid_from_str(valid_str_1, uuid2); + assert(ret == 0); ret = uuid1 == uuid2; ok(ret == true, "lttng_uuid_is_equal - Compare same UUID, expect success"); - lttng_uuid_from_str(valid_str_2, uuid2); + ret = lttng_uuid_from_str(valid_str_2, uuid2); + assert(ret == 0); ret = uuid1 == uuid2; ok(ret == false, "lttng_uuid_is_equal - Compare different UUID, expect failure"); } -- 2.34.1