RE: [PATCH v5 4/4] lib/test_printf.c: add test cases for '%pD'
From: Justin He <hidden>
Date: 2021-06-23 03:28:13
Also in:
linux-fsdevel, lkml
Hi Rasmus
-----Original Message----- From: Rasmus Villemoes <linux@rasmusvillemoes.dk> Sent: Wednesday, June 23, 2021 4:52 AM To: Justin He <redacted>; Petr Mladek <pmladek@suse.com>; Steven Rostedt [off-list ref]; Sergey Senozhatsky [off-list ref]; Andy Shevchenko [off-list ref]; Jonathan Corbet [off-list ref]; Alexander Viro [off-list ref]; Linus Torvalds <torvalds@linux- foundation.org> Cc: Peter Zijlstra (Intel) <peterz@infradead.org>; Eric Biggers [off-list ref]; Ahmed S. Darwish [off-list ref]; linux- doc@vger.kernel.org; linux-kernel@vger.kernel.org; linux- fsdevel@vger.kernel.org; Matthew Wilcox [off-list ref]; Christoph Hellwig [off-list ref]; nd [off-list ref] Subject: Re: [PATCH v5 4/4] lib/test_printf.c: add test cases for '%pD' On 22/06/2021 16.06, Jia He wrote:quoted
After the behaviour of specifier '%pD' is changed to print the full path of struct file, the related test cases are also updated. Given the full path string of '%pD' is prepended from the end of thescratchquoted
buffer, the check of "wrote beyond the nul-terminator" should be skipped for '%pD'. Parameterize the new using_scratch_space in __test, do_test to skip the test case mentioned above,I actually prefer the first suggestion of just having a file-global bool.
Yes, this is my previous proposal, but seems it is not satisfying 😉. -- Cheers, Justin (Jia He)
If and when we get other checks that need to be done selectively [e.g. "snprintf into a too short buffer produces a prefix of the full string", which also came up during this discussion but was ultimately kept] depending on the %<whatever> being exercised, we can add a "u32 nocheck" with a bunch of bits saying what to elide. Not insisting either way, just my $0.02.