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]
Date:   Fri,  1 Jul 2022 15:17:23 -0300
From:   Maíra Canal <mairacanal@...eup.net>
To:     Brendan Higgins <brendanhiggins@...gle.com>,
        Jonathan Corbet <corbet@....net>, davidgow@...gle.com
Cc:     linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
        Maíra Canal <mairacanal@...eup.net>
Subject: [PATCH] Documentation: Kunit: Fix example with compilation error

The Parameterized Testing example contains a compilation error, as the
signature for the description helper function should be void(*)(struct
sha1_test_case *, char *), so the struct should not be const. This is
warned by Clang:

error: initialization of ‘void (*)(struct sha1_test_case *, char *)’
from incompatible pointer type ‘void (*)(const struct sha1_test_case *,
char *)’ [-Werror=incompatible-pointer-types]
    33 | KUNIT_ARRAY_PARAM(sha1, cases, case_to_desc);
       |                                ^~~~~~~~~~~~
../include/kunit/test.h:1339:70: note: in definition of macro
‘KUNIT_ARRAY_PARAM’
1339 |                         void (*__get_desc)(typeof(__next), char *) = get_desc; \

Signed-off-by: Maíra Canal <mairacanal@...eup.net>
---
 Documentation/dev-tools/kunit/usage.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/dev-tools/kunit/usage.rst b/Documentation/dev-tools/kunit/usage.rst
index d62a04255c2e..8e72fb277058 100644
--- a/Documentation/dev-tools/kunit/usage.rst
+++ b/Documentation/dev-tools/kunit/usage.rst
@@ -517,7 +517,7 @@ By reusing the same ``cases`` array from above, we can write the test as a
 	};
 
 	// Need a helper function to generate a name for each test case.
-	static void case_to_desc(const struct sha1_test_case *t, char *desc)
+	static void case_to_desc(struct sha1_test_case *t, char *desc)
 	{
 		strcpy(desc, t->str);
 	}
-- 
2.36.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ