RE: [PATCH v1 1/1] dm integrity: Use %*ph for printing hexdump of a small buffer

From: David Laight
Date: Tue Jun 13 2023 - 09:14:08 EST


From: Andy Shevchenko
> Sent: 12 June 2023 22:48
>
> The kernel already has a helper to print a hexdump of a small
> buffer via pointer extension. Use that instead of open coded
> variant.
>
> In long term it helps to kill pr_cont() or at least narrow down
> its use.
>
> Note, the format is slightly changed, i.e. the colon is not printed
> before the buffer dump and the trailing space is always printed.
> These are not a problem since it's a debug message. Also the IV dump
> is limited by 64 bytes which seems fine.
...
> +#define DEBUG_bytes(bytes, len, msg, ...) printk(KERN_DEBUG msg " %*ph\n", ##__VA_ARGS__, len,
> bytes)

Using:
printf(KERN_DEBUG msg "%s%*ph\n", ##__VA_ARGS__, len ? ": " : "", len, bytes)
would add back the optional ':'.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)