]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
lib/cmdline: Fix an invalid format specifier in an assertion msg
authorDavid Gow <davidgow@google.com>
Wed, 21 Feb 2024 09:27:15 +0000 (17:27 +0800)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:19:18 +0000 (18:19 -0400)
commit8d98a46b8b45534cbbf21d99a17b857b5f9e984d
treee90e7e8f17cf5daa004bad46ebc6a982d0512cad
parent8c018386023b949a23a77ba2cd5c43ee626f4609
lib/cmdline: Fix an invalid format specifier in an assertion msg

[ Upstream commit d2733a026fc7247ba42d7a8e1b737cf14bf1df21 ]

The correct format specifier for p - n (both p and n are pointers) is
%td, as the type should be ptrdiff_t.

This was discovered by annotating KUnit assertion macros with gcc's
printf specifier, but note that gcc incorrectly suggested a %d or %ld
specifier (depending on the pointer size of the architecture being
built).

Fixes: 0ea09083116d ("lib/cmdline: Allow get_options() to take 0 to validate the input")
Signed-off-by: David Gow <davidgow@google.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Daniel Latypov <dlatypov@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
lib/cmdline_kunit.c