diff options
author | Hari Bathini <hbathini@linux.vnet.ibm.com> | 2017-08-09 23:47:42 +0530 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2017-08-10 09:28:22 +0200 |
commit | 21eb397a5fc9227cd95d23e8c74a49cf6a293e57 (patch) | |
tree | 068cbf0a2ce63985810d4ce7b87306147be40f17 /kexec/arch/ppc/crashdump-powerpc.c | |
parent | 47478ea66d4301b12a07862aebc8447a2932f0ed (diff) |
kexec-tools: powerpc: fix command line overflow error
Since kernel commit a5980d064fe2 ("powerpc: Bump COMMAND_LINE_SIZE
to 2048"), powerpc bumped command line size to 2048 but the size
used here is still the default value of 512. Bump it to 2048 to
fix command line overflow errors observed when command line length
is above 512 bytes. Also, get rid of the multiple definitions of
COMMAND_LINE_SIZE macro in ppc architecture.
Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/arch/ppc/crashdump-powerpc.c')
-rw-r--r-- | kexec/arch/ppc/crashdump-powerpc.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/kexec/arch/ppc/crashdump-powerpc.c b/kexec/arch/ppc/crashdump-powerpc.c index dde6de7..4ad026f 100644 --- a/kexec/arch/ppc/crashdump-powerpc.c +++ b/kexec/arch/ppc/crashdump-powerpc.c @@ -252,8 +252,12 @@ static void ulltoa(unsigned long long i, char *str) /* Append str to cmdline */ static void add_cmdline(char *cmdline, char *str) { + int cmdline_size; int cmdlen = strlen(cmdline) + strlen(str); - if (cmdlen > (COMMAND_LINE_SIZE - 1)) + + cmdline_size = (kernel_version() < KERNEL_VERSION(3, 15, 0) ? + 512 : COMMAND_LINE_SIZE); + if (cmdlen > (cmdline_size - 1)) die("Command line overflow\n"); strcat(cmdline, str); } |