Some minor cleanup patches resent
Subsystems (7)
cover Some minor cleanup patches resent
These three patches are reviewed and acked, are all trivial clean up patches.
And for the patch "kexec: replace crash_mem_range with range", I got a ibm-p9wr ppc64le system to test, it works well.
Hi Andrew,
Please help pick them into mm-nonmm-unstable branch.
Chen Lifu (1):
ARM: kexec: Make machine_crash_nonpanic_core() static
Jianglei Nie (1):
proc/vmcore: fix potential memory leak in vmcore_init()
Li Chen (1):
kexec: replace crash_mem_range with range
ye xingchen (1):
kexec: Remove the unneeded result variable
arch/arm/kernel/machine_kexec.c | 2 +- arch/powerpc/kexec/file_load_64.c | 2 +- arch/powerpc/kexec/ranges.c | 8 ++++---- fs/proc/vmcore.c | 1 + include/linux/kexec.h | 7 ++----- kernel/kexec_core.c | 10 ++-------- kernel/kexec_file.c | 2 +- 7 files changed, 12 insertions(+), 20 deletions(-)
Signature · 1 line
2.34.1
PATCH RESEND 1/4 proc/vmcore: fix potential memory leak in vmcore_init()
From: Jianglei Nie <[email protected]>
elfcorehdr_alloc() allocates a memory chunk for elfcorehdr_addr with kzalloc(). If is_vmcore_usable() returns false, elfcorehdr_addr is a predefined value. If parse_crash_elf_headers() gets some error and returns a negetive value, the elfcorehdr_addr should be released with elfcorehdr_free().
Fix it by calling elfcorehdr_free() when parse_crash_elf_headers() fails.
--- fs/proc/vmcore.c | 1 + 1 file changed, 1 insertion(+)
fs/proc/vmcore.c +1 -0
@@ -1567,6 +1567,7 @@ static int __init vmcore_init(void)return rc; rc =parse_crash_elf_headers ();if (rc) { +elfcorehdr_free (elfcorehdr_addr);pr_warn ("Kdump: vmcore not initialized\n" );return rc; }
Signature · 1 line
2.34.1
PATCH RESEND 2/4 kexec: Remove the unneeded result variable
In reply to Baoquan HeFrom: ye xingchen <[email protected]>
Return the value kimage_add_entry() directly instead of storing it in another redundant variable.
--- kernel/kexec_core.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
kernel/kexec_core.c +2 -8
@@ -561,23 +561,17 @@ static int kimage_add_entry(struct kimage *image, kimage_entry_t entry)static int kimage_set_destination (struct kimage *image,unsigned long destination) { -int result; - destination &=PAGE_MASK ; - result =kimage_add_entry (image, destination |IND_DESTINATION ); -return result; +return kimage_add_entry (image, destination |IND_DESTINATION ); }static int kimage_add_page (struct kimage *image,unsigned long page) { -int result; - page &=PAGE_MASK ; - result =kimage_add_entry (image, page |IND_SOURCE ); -return result; +return kimage_add_entry (image, page |IND_SOURCE ); }
Signature · 7 lines
2.34.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH RESEND 3/4 kexec: replace crash_mem_range with range
In reply to Baoquan HeFrom: Li Chen <[email protected]>
We already have struct range, so just use it.
---
Baoquan:
- Rebased to the latest linus's master branch, fix the conflict in include/linux/kexec.h.
- Test passed on ibm-p9wr ppc64le system.
arch/powerpc/kexec/file_load_64.c | 2 +- arch/powerpc/kexec/ranges.c | 8 ++++---- include/linux/kexec.h | 7 ++----- kernel/kexec_file.c | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-)
arch/powerpc/kexec/file_load_64.c +1 -1
@@ -35,7 +35,7 @@ struct umem_info {/* usable memory ranges to look up */ unsigned int nr_ranges; -const struct crash_mem_range *ranges; +const struct range *ranges; };const struct kexec_file_ops *const kexec_file_loaders[] = {
arch/powerpc/kexec/ranges.c +4 -4
@@ -33,7 +33,7 @@static inline unsigned int get_max_nr_ranges (size_t size) {return ((size -sizeof (struct crash_mem )) / -sizeof (struct crash_mem_range )); +sizeof (struct range )); }/**
@@ -51,7 +51,7 @@ static inline size_t get_mem_rngs_size(struct crash_mem *mem_rngs)return 0 ; size = (sizeof (struct crash_mem ) + - (mem_rngs->max_nr_ranges *sizeof (struct crash_mem_range ))); + (mem_rngs->max_nr_ranges *sizeof (struct range )));/* * Memory is allocated in size multiple of MEM_RANGE_CHUNK_SZ.
@@ -98,7 +98,7 @@ static int __add_mem_range(struct crash_mem **mem_ranges, u64 base, u64 size)*/ static void __merge_memory_ranges (struct crash_mem *mem_rngs) { -struct crash_mem_range *ranges; +struct range *ranges;int i, idx;if (!mem_rngs)
@@ -123,7 +123,7 @@ static void __merge_memory_ranges(struct crash_mem *mem_rngs)/* cmp_func_t callback to sort ranges with sort() */ static int rngcmp (const void *_x,const void *_y) { -const struct crash_mem_range *x = _x, *y = _y; +const struct range *x = _x, *y = _y;if (x->start > y->start)return 1 ;
include/linux/kexec.h +2 -5
@@ -17,6 +17,7 @@#include <linux/crash_core.h> #include <asm/io.h> +#include <linux/range.h> #include <uapi/linux/kexec.h> #include <linux/verification.h>
@@ -240,14 +241,10 @@ static inline int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf)/* Alignment required for elf header segment */ #define ELF_CORE_HEADER_ALIGN 4096 -struct crash_mem_range { -u64 start, end; -}; -struct crash_mem {unsigned int max_nr_ranges;unsigned int nr_ranges; -struct crash_mem_range ranges[]; +struct range ranges[]; }; extern int crash_exclude_mem_range(struct crash_mem *mem,
kernel/kexec_file.c +1 -1
@@ -1141,7 +1141,7 @@ int crash_exclude_mem_range(struct crash_mem *mem, {int i, j;unsigned long long start, end, p_start, p_end; -struct crash_mem_range temp_range = {0 ,0 }; +struct range temp_range = {0 ,0 };for (i =0 ; i < mem->nr_ranges; i++) { start = mem->ranges[i].start;
Signature · 7 lines
2.34.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH RESEND 4/4 ARM: kexec: Make machine_crash_nonpanic_core() static
In reply to Baoquan HeFrom: Chen Lifu <[email protected]>
This symbol is not used outside of the file, so mark it static.
Fixes the following warning:
arch/arm/kernel/machine_kexec.c:76:6: warning: symbol 'machine_crash_nonpanic_core' was not declared. Should it be static?
--- arch/arm/kernel/machine_kexec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/kernel/machine_kexec.c +1 -1
@@ -73,7 +73,7 @@ void machine_kexec_cleanup(struct kimage *image) { } -void machine_crash_nonpanic_core (void *unused) +static void machine_crash_nonpanic_core (void *unused) {struct pt_regs regs;
Signature · 7 lines
2.34.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec