From: Jérémie Galarneau Date: Tue, 14 Jun 2022 14:56:35 +0000 (-0400) Subject: Tests: test_uuid: unchecked return value X-Git-Url: https://git.liburcu.org/?p=lttng-tools.git;a=commitdiff_plain;h=b60adc34d7bdb6f1a36a8ea45164942ab54e4bbe Tests: test_uuid: unchecked return value 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 --- 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"); }