On 10/11/23 02:23, Maciej Wieczor-Retman wrote:
Kselftest header defines multiple variadic functions that use printf along with other logic.
There is no format checking for the variadic functions that use printing inside kselftest.h. Because of this the compiler won't be able to catch instances of mismatched printf formats and debugging tests might be more difficult.
Add the common __printf attribute macro to kselftest.h.
Add __printf attribute to every function using formatted printing with variadic arguments.
Signed-off-by: Maciej Wieczor-Retman maciej.wieczor-retman@intel.com Reviewed-by: Ilpo Järvinen ilpo.jarvinen@linux.intel.com Reviewed-by: Reinette Chatre reinette.chatre@intel.com
Changelog v4:
- Fix typo in patch subject. (Reinette)
- Add Reinette's reviewed-by tag.
I still need information on how you found these problems. Please add it to change log for each of these patches.
I am seeing checkpatch warning:
WARNING: Prefer __printf(a, b) over __attribute__((format(printf, a, b))) #102: FILE: tools/testing/selftests/kselftest.h:81: +#define __printf(a, b) __attribute__((format(printf, a, b)))
thanks, -- Shuah