net: test: Fix printf format specifier in skb_segment kunit test
authorDavid Gow <davidgow@google.com>
Wed, 21 Feb 2024 09:27:19 +0000 (17:27 +0800)
committerShuah Khan <skhan@linuxfoundation.org>
Tue, 27 Feb 2024 23:27:17 +0000 (16:27 -0700)
KUNIT_FAIL() accepts a printf-style format string, but previously did
not let gcc validate it with the __printf() attribute. The use of %lld
for the result of PTR_ERR() is not correct.

Instead, use %pe and pass the actual error pointer. printk() will format
it correctly (and give a symbolic name rather than a number if
available, which should make the output more readable, too).

Fixes: b3098d32ed6e ("net: add skb_segment kunit test")
Signed-off-by: David Gow <davidgow@google.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Justin Stitt <justinstitt@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
net/core/gso_test.c

index 4c2e77bd12f4b17f57f115ce4f9b99fb1da0a875..358c44680d917dfe8b324ab3a2a86fe78de44930 100644 (file)
@@ -225,7 +225,7 @@ static void gso_test_func(struct kunit *test)
 
        segs = skb_segment(skb, features);
        if (IS_ERR(segs)) {
-               KUNIT_FAIL(test, "segs error %lld", PTR_ERR(segs));
+               KUNIT_FAIL(test, "segs error %pe", segs);
                goto free_gso_skb;
        } else if (!segs) {
                KUNIT_FAIL(test, "no segments");