Subject: Re: [RFC PATCH v1] powerpc: Enable KFENCE for PPC32

From: Andreas Schwab <[email-masked]>
Date: Wed, 03 Mar 2021 11:46:34 +0100

On Mär 03 2021, Marco Elver wrote:

> On Wed, 3 Mar 2021 at 11:32, Christophe Leroy
> <[email-masked]> wrote:
>> ./include/linux/kern_levels.h:5:18: warning: format '%zd' expects argument of type 'signed size_t',
>> but argument 3 has type 'ptrdiff_t' {aka 'const long int'} [-Wformat=]
>>      5 | #define KERN_SOH "\001"  /* ASCII Start Of Header */
>>        |                  ^~~~~~
>> ./include/linux/kern_levels.h:11:18: note: in expansion of macro 'KERN_SOH'
>>     11 | #define KERN_ERR KERN_SOH "3" /* error conditions */
>>        |                  ^~~~~~~~
>> ./include/linux/printk.h:343:9: note: in expansion of macro 'KERN_ERR'
>>    343 |  printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
>>        |         ^~~~~~~~
>> mm/kfence/report.c:233:3: note: in expansion of macro 'pr_err'
>>    233 |   pr_err("Invalid free of 0x%p (in kfence-#%zd):\n", (void *)address,
>>        |   ^~~~~~
>>
>> Christophe
>
> No this is not expected. Is 'signed size_t' != 'long int' on ppc32?

If you want to format a ptrdiff_t you should use %td.

Andreas.

-- 
Andreas Schwab, [email-masked]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."