lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221226125736.18053-1-jose.exposito89@gmail.com>
Date:   Mon, 26 Dec 2022 13:57:36 +0100
From:   José Expósito <jose.exposito89@...il.com>
To:     jikos@...nel.org
Cc:     benjamin.tissoires@...hat.com, mcanal@...lia.com,
        mairacanal@...eup.net, linux-input@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        José Expósito <jose.exposito89@...il.com>
Subject: [PATCH] HID: uclogic: Use KUNIT_EXPECT_MEMEQ

Commit b8a926bea8b1 ("kunit: Introduce KUNIT_EXPECT_MEMEQ and
KUNIT_EXPECT_MEMNEQ macros") introduced a new macro to compare blocks of
memory and, if the test fails, print the result in a human friendly
format. For example, this is the output of a test failure:

 Expected res == params->expected, but
     res ==
      01  02  aa  00  00  00  03  bb  00 <00> 00  04  05
     params->expected ==
      01  02  aa  00  00  00  03  bb  00 <01> 00  04  05

Use this new macro to replace KUNIT_EXPECT_EQ + memcmp.

Signed-off-by: José Expósito <jose.exposito89@...il.com>
---
 drivers/hid/hid-uclogic-rdesc-test.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/hid/hid-uclogic-rdesc-test.c b/drivers/hid/hid-uclogic-rdesc-test.c
index b429c541bf2f..90bf4e586e01 100644
--- a/drivers/hid/hid-uclogic-rdesc-test.c
+++ b/drivers/hid/hid-uclogic-rdesc-test.c
@@ -197,8 +197,7 @@ static void hid_test_uclogic_template(struct kunit *test)
 					   params->param_list,
 					   params->param_num);
 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, res);
-	KUNIT_EXPECT_EQ(test, 0,
-			memcmp(res, params->expected, params->template_size));
+	KUNIT_EXPECT_MEMEQ(test, res, params->expected, params->template_size);
 	kfree(res);
 }
 
-- 
2.38.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ