From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965656AbdD0Hjl (ORCPT ); Thu, 27 Apr 2017 03:39:41 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:46865 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964873AbdD0Hjc (ORCPT ); Thu, 27 Apr 2017 03:39:32 -0400 Subject: Re: [PATCH v4 2/3] powerpc/fadump: Use the correct VMCOREINFO_NOTE_SIZE for phdr To: Dave Young , Xunlei Pang References: <1492688374-27903-1-git-send-email-xlpang@redhat.com> <1492688374-27903-2-git-send-email-xlpang@redhat.com> <20170426071114.GC5381@dhcp-128-65.nay.redhat.com> Cc: Baoquan He , kexec@lists.infradead.org, Petr Tesarik , linux-kernel@vger.kernel.org, Eric Biederman , Hari Bathini , akpm@linux-foundation.org, linuxppc-dev@lists.ozlabs.org From: Mahesh Jagannath Salgaonkar Date: Thu, 27 Apr 2017 13:08:24 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170426071114.GC5381@dhcp-128-65.nay.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable x-cbid: 17042707-0016-0000-0000-00000234FC64 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17042707-0017-0000-0000-000006B07E0A Message-Id: <8a4b3bcc-466c-4f8c-c813-c57a600bf038@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-04-27_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1704270128 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/26/2017 12:41 PM, Dave Young wrote: > Ccing ppc list > On 04/20/17 at 07:39pm, Xunlei Pang wrote: >> vmcoreinfo_max_size stands for the vmcoreinfo_data, the >> correct one we should use is vmcoreinfo_note whose total >> size is VMCOREINFO_NOTE_SIZE. >> >> Like explained in commit 77019967f06b ("kdump: fix exported >> size of vmcoreinfo note"), it should not affect the actual >> function, but we better fix it, also this change should be >> safe and backward compatible. >> >> After this, we can get rid of variable vmcoreinfo_max_size, >> let's use the corresponding macros directly, fewer variables >> means more safety for vmcoreinfo operation. >> >> Cc: Mahesh Salgaonkar >> Cc: Hari Bathini >> Signed-off-by: Xunlei Pang Reviewed-by: Mahesh Salgaonkar Thanks, -Mahesh. >> --- >> v3->v4: >> -Rebased on the latest linux-next >> >> arch/powerpc/kernel/fadump.c | 3 +-- >> include/linux/crash_core.h | 1 - >> kernel/crash_core.c | 3 +-- >> 3 files changed, 2 insertions(+), 5 deletions(-) >> >> diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c >> index 466569e..7bd6cd0 100644 >> --- a/arch/powerpc/kernel/fadump.c >> +++ b/arch/powerpc/kernel/fadump.c >> @@ -893,8 +893,7 @@ static int fadump_create_elfcore_headers(char *bufp) >> >> phdr->p_paddr = fadump_relocate(paddr_vmcoreinfo_note()); >> phdr->p_offset = phdr->p_paddr; >> - phdr->p_memsz = vmcoreinfo_max_size; >> - phdr->p_filesz = vmcoreinfo_max_size; >> + phdr->p_memsz = phdr->p_filesz = VMCOREINFO_NOTE_SIZE; >> >> /* Increment number of program headers. */ >> (elf->e_phnum)++; >> diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h >> index ba283a2..7d6bc7b 100644 >> --- a/include/linux/crash_core.h >> +++ b/include/linux/crash_core.h >> @@ -55,7 +55,6 @@ >> >> extern u32 *vmcoreinfo_note; >> extern size_t vmcoreinfo_size; >> -extern size_t vmcoreinfo_max_size; >> >> Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type, >> void *data, size_t data_len); >> diff --git a/kernel/crash_core.c b/kernel/crash_core.c >> index 0321f04..43cdb00 100644 >> --- a/kernel/crash_core.c >> +++ b/kernel/crash_core.c >> @@ -16,7 +16,6 @@ >> /* vmcoreinfo stuff */ >> static unsigned char *vmcoreinfo_data; >> size_t vmcoreinfo_size; >> -size_t vmcoreinfo_max_size = VMCOREINFO_BYTES; >> u32 *vmcoreinfo_note; >> >> /* >> @@ -343,7 +342,7 @@ void vmcoreinfo_append_str(const char *fmt, ...) >> r = vscnprintf(buf, sizeof(buf), fmt, args); >> va_end(args); >> >> - r = min(r, vmcoreinfo_max_size - vmcoreinfo_size); >> + r = min(r, VMCOREINFO_BYTES - vmcoreinfo_size); >> >> memcpy(&vmcoreinfo_data[vmcoreinfo_size], buf, r); >> >> -- >> 1.8.3.1 >> >> >> _______________________________________________ >> kexec mailing list >> kexec@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/kexec > > Reviewed-by: Dave Young > > Thanks > Dave >