Re: [PATCH] KEYS: encrypted: Use pr_fmt()

Thorsten Blum
2025-11-19T14:45:19Z

On 19. Nov 2025, at 03:48, Jarkko Sakkinen wrote:
> On Thu, Nov 13, 2025 at 01:35:44PM +0100, Thorsten Blum wrote:
>> Use pr_fmt() to automatically prefix all pr_<level>() log messages with
>
> This fails to describe what "use" means.

I don't understand what you mean. What's wrong with "use ... to ..."?

>> "encrypted_key: " and remove all manually added prefixes.
>>
>> Reformat the code accordingly and avoid line breaks in log messages.
>>
>> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
>> ---
>> security/keys/encrypted-keys/encrypted.c | 74 +++++++++++-------------
>> security/keys/encrypted-keys/encrypted.h | 2 +-
>> 2 files changed, 35 insertions(+), 41 deletions(-)
>>
>> diff --git a/security/keys/encrypted-keys/encrypted.c b/security/keys/encrypted-keys/encrypted.c
>> index 513c09e2b01c..a8e8bf949b4b 100644
>> --- a/security/keys/encrypted-keys/encrypted.c
>> +++ b/security/keys/encrypted-keys/encrypted.c
>> @@ -11,6 +11,8 @@
>> * See Documentation/security/keys/trusted-encrypted.rst
>> */
>>
>
> Should have undef prepending.

Why is this necessary when the #define is at the top of a source file?
The kernel documentation [1] doesn't mention this anywhere. Isn't #undef
only needed when redefining 'pr_fmt' in the middle of a file to avoid a
compiler warning/error?

>> +#define pr_fmt(fmt) "encrypted_key: " fmt
>> +
>> [...]

Thanks,
Thorsten

[1] https://docs.kernel.org/core-api/printk-basics.html