powerpc/kexec_file: use snprintf to simplify setup_kdump_cmdline

Replace the manual string length accounting, memcpy(), and NUL
termination with a single snprintf() call to prepend the elfcorehdr=
address and to detect string truncation at the same time.

Use kmalloc() to avoid unnecessarily zeroing the memory. While at it,
also use "prepending" instead of "appending" in the error message.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20260527000105.1081651-3-thorsten.blum@linux.dev
This commit is contained in:
Thorsten Blum 2026-05-27 02:01:06 +02:00 • committed by Madhavan Srinivasan
commit dd6c80abf4