Re: [PATCH v4 0/8] Add printf attribute to kselftest functions

From: Maciej Wieczór-Retman
Date: Tue Oct 10 2023 - 01:53:36 EST


On 2023-10-09 at 11:28:30 -0600, Shuah Khan wrote:
>On 10/9/23 04:28, Maciej Wieczor-Retman wrote:
>> Kselftest.h declares many variadic functions that can print some
>> formatted message while also executing selftest logic. These
>> declarations don't have any compiler mechanism to verify if passed
>> arguments are valid in comparison with format specifiers used in
>> printf() calls.
>>
>> Attribute addition can make debugging easier, the code more consistent
>> and prevent mismatched or missing variables.
>>
>> Add a __printf() macro that validates types of variables passed to the
>> format string. The macro is similarly used in other tools in the kernel.
>>
>> Add __printf() attributes to function definitions inside kselftest.h that
>> use printing.
>>
>> Adding the __printf() macro exposes some mismatches in format strings
>> across different selftests.
>>
>> Fix the mismatched format specifiers in multiple tests.
>>
>> Series is based on kselftests next branch.
>
>How did you find these problems? I don't see any information
>how these problems are found in the commit logs.
>
>thanks,
>-- Shuah

I wrote the first patch that adds the check to functions with format
specifiers and I compiled all selftests. Then I just corrected any
warnings that were found by the __printf attribute.

Should I mention the methodology in the cover letter?

--
Kind regards
Maciej Wieczór-Retman