<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/lib/tests/printf_kunit.c, branch v6.18.21</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.18.21</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.18.21'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-04-29T13:29:33+00:00</updated>
<entry>
<title>vsprintf: Use %p4chR instead of %p4cn for reading data in reversed host ordering</title>
<updated>2025-04-29T13:29:33+00:00</updated>
<author>
<name>Petr Mladek</name>
<email>pmladek@suse.com</email>
</author>
<published>2025-04-28T12:31:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=37eed892cc5ff36aeee59bb78f6aa417a44030a9'/>
<id>urn:sha1:37eed892cc5ff36aeee59bb78f6aa417a44030a9</id>
<content type='text'>
The generic FourCC format always prints the data using the big endian
order. It is generic because it allows to read the data using a custom
ordering.

The current code uses "n" for reading data in the reverse host ordering.
It makes the 4 variants [hnbl] consistent with the generic printing
of IPv4 addresses.

Unfortunately, it creates confusion on big endian systems. For example,
it shows the data &amp;(u32)0x67503030 as

	%p4cn	00Pg (0x30305067)

But people expect that the ordering stays the same. The network ordering
is a big-endian ordering.

The problem is that the semantic is not the same. The modifiers affect
the output ordering of IPv4 addresses while they affect the reading order
in case of FourCC code.

Avoid the confusion by replacing the "n" modifier with "hR", aka
reverse host ordering. It is inspired by the existing %p[mM]R printf
format.

Reported-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
Closes: https://lore.kernel.org/r/CAMuHMdV9tX=TG7E_CrSF=2PY206tXf+_yYRuacG48EWEtJLo-Q@mail.gmail.com
Signed-off-by: Petr Mladek &lt;pmladek@suse.com&gt;
Acked-by: Alyssa Rosenzweig &lt;alyssa@rosenzweig.io&gt;
Reviewed-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Reviewed-by: Aditya Garg &lt;gargaditya08@live.com&gt;
Link: https://lore.kernel.org/r/20250428123132.578771-1-pmladek@suse.com
Signed-off-by: Alyssa Rosenzweig &lt;alyssa@rosenzweig.io&gt;
</content>
</entry>
<entry>
<title>printf: add tests for generic FourCCs</title>
<updated>2025-04-21T14:18:30+00:00</updated>
<author>
<name>Aditya Garg</name>
<email>gargaditya08@live.com</email>
</author>
<published>2025-04-08T06:48:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=403ff8fd2dbf5066128af4d1fde76c35a800369d'/>
<id>urn:sha1:403ff8fd2dbf5066128af4d1fde76c35a800369d</id>
<content type='text'>
This patch adds support for kunit tests of generic 32-bit FourCCs added to
vsprintf.

Acked-by: Tamir Duberstein &lt;tamird@gmail.com&gt;
Reviewed-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Reviewed-by: Petr Mladek &lt;pmladek@suse.com&gt;
Tested-by: Petr Mladek &lt;pmladek@suse.com&gt;
Signed-off-by: Aditya Garg &lt;gargaditya08@live.com&gt;
Reviewed-by: Kees Cook &lt;kees@kernel.org&gt;
Link: https://lore.kernel.org/r/PN3PR01MB95973AF4F6262B2D1996FB25B8B52@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM
Signed-off-by: Alyssa Rosenzweig &lt;alyssa@rosenzweig.io&gt;
</content>
</entry>
<entry>
<title>printf: implicate test line in failure messages</title>
<updated>2025-03-13T17:26:33+00:00</updated>
<author>
<name>Tamir Duberstein</name>
<email>tamird@gmail.com</email>
</author>
<published>2025-03-07T22:08:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=034bee685fd48101aff31591273258be0377b1ef'/>
<id>urn:sha1:034bee685fd48101aff31591273258be0377b1ef</id>
<content type='text'>
This improves the failure output by pointing to the failing line at the
top level of the test, e.g.:
      # test_number: EXPECTATION FAILED at lib/printf_kunit.c:103
  lib/printf_kunit.c:167: vsnprintf(buf, 256, "%#-12x", ...) wrote '0x1234abcd  ', expected '0x1234abce  '
      # test_number: EXPECTATION FAILED at lib/printf_kunit.c:142
  lib/printf_kunit.c:167: kvasprintf(..., "%#-12x", ...) returned '0x1234abcd  ', expected '0x1234abce  '

Signed-off-by: Tamir Duberstein &lt;tamird@gmail.com&gt;
Reviewed-by: Petr Mladek &lt;pmladek@suse.com&gt;
Tested-by: Petr Mladek &lt;pmladek@suse.com&gt;
Link: https://lore.kernel.org/r/20250307-printf-kunit-convert-v6-3-4d85c361c241@gmail.com
Signed-off-by: Kees Cook &lt;kees@kernel.org&gt;
</content>
</entry>
<entry>
<title>printf: break kunit into test cases</title>
<updated>2025-03-13T17:26:33+00:00</updated>
<author>
<name>Tamir Duberstein</name>
<email>tamird@gmail.com</email>
</author>
<published>2025-03-07T22:08:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=81a03aa9b88c5db19a6008a3dc43280637e45d84'/>
<id>urn:sha1:81a03aa9b88c5db19a6008a3dc43280637e45d84</id>
<content type='text'>
Move all tests into `printf_test_cases`. This gives us nicer output in
the event of a failure.

Combine `plain_format` and `plain_hash` into `hash_pointer` since
they're testing the same scenario.

Signed-off-by: Tamir Duberstein &lt;tamird@gmail.com&gt;
Reviewed-by: Petr Mladek &lt;pmladek@suse.com&gt;
Tested-by: Petr Mladek &lt;pmladek@suse.com&gt;
Link: https://lore.kernel.org/r/20250307-printf-kunit-convert-v6-2-4d85c361c241@gmail.com
Signed-off-by: Kees Cook &lt;kees@kernel.org&gt;
</content>
</entry>
<entry>
<title>printf: convert self-test to KUnit</title>
<updated>2025-03-13T17:26:33+00:00</updated>
<author>
<name>Tamir Duberstein</name>
<email>tamird@gmail.com</email>
</author>
<published>2025-03-07T22:08:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7a79e7daa84e230266184a2018507551086c2317'/>
<id>urn:sha1:7a79e7daa84e230266184a2018507551086c2317</id>
<content type='text'>
Convert the printf() self-test to a KUnit test.

In the interest of keeping the patch reasonably-sized this doesn't
refactor the tests into proper parameterized tests - it's all one big
test case.

Signed-off-by: Tamir Duberstein &lt;tamird@gmail.com&gt;
Reviewed-by: Petr Mladek &lt;pmladek@suse.com&gt;
Tested-by: Petr Mladek &lt;pmladek@suse.com&gt;
Link: https://lore.kernel.org/r/20250307-printf-kunit-convert-v6-1-4d85c361c241@gmail.com
Signed-off-by: Kees Cook &lt;kees@kernel.org&gt;
</content>
</entry>
</feed>
