summaryrefslogtreecommitdiff
path: root/kexec/firmware_memmap.c
AgeCommit message (Collapse)Author
2020-09-29kexec: Fix snprintf related compilation warningsBhupesh Sharma
This patch fixes the following snprintf related compilation warning seen currently with gcc versions 7 and 8 when kexec is compiled with -Wformat-truncation option: kexec/fs2dt.c:673:34: warning: ‘stdout-path’ directive output may be truncated writing 11 bytes into a region of size between 1 and 1024 [-Wformat-truncation=] snprintf(filename, MAXPATH, "%sstdout-path", pathname); ^~~~~~~~~~~ kexec/fs2dt.c:673:3: note: ‘snprintf’ output between 12 and 1035 bytes into a destination of size 1024 snprintf(filename, MAXPATH, "%sstdout-path", pathname); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kexec/fs2dt.c:676:35: warning: ‘linux,stdout-path’ directive output may be truncated writing 17 bytes into a region of size between 1 and 1024 [-Wformat-truncation=] snprintf(filename, MAXPATH, "%slinux,stdout-path", pathname); ^~~~~~~~~~~~~~~~~ kexec/fs2dt.c:676:4: note: ‘snprintf’ output between 18 and 1041 bytes into a destination of size 1024 snprintf(filename, MAXPATH, "%slinux,stdout-path", pathname); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kexec/firmware_memmap.c:132:35: warning: ‘%s’ directive output may be truncated writing 5 bytes into a region of size between 0 and 4095 [-Wformat-truncation=] snprintf(filename, PATH_MAX, "%s/%s", entry, "start"); ^~ ~~~~~~~ kexec/firmware_memmap.c:132:2: note: ‘snprintf’ output between 7 and 4102 bytes into a destination of size 4096 snprintf(filename, PATH_MAX, "%s/%s", entry, "start"); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kexec/firmware_memmap.c:142:35: warning: ‘%s’ directive output may be truncated writing 3 bytes into a region of size between 0 and 4095 [-Wformat-truncation=] snprintf(filename, PATH_MAX, "%s/%s", entry, "end"); ^~ ~~~~~ kexec/firmware_memmap.c:142:2: note: ‘snprintf’ output between 5 and 4100 bytes into a destination of size 4096 snprintf(filename, PATH_MAX, "%s/%s", entry, "end"); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kexec/firmware_memmap.c:152:35: warning: ‘%s’ directive output may be truncated writing 4 bytes into a region of size between 0 and 4095 [-Wformat-truncation=] snprintf(filename, PATH_MAX, "%s/%s", entry, "type"); ^~ ~~~~~~ kexec/firmware_memmap.c:152:2: note: ‘snprintf’ output between 6 and 4101 bytes into a destination of size 4096 snprintf(filename, PATH_MAX, "%s/%s", entry, "type"); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Since the simplest method to address the gcc warnings and possible truncation would be to check the return value provided from snprintf (well there are other methods like using 'asnprintf' or using 'open_memstream' function to create the FILE object, but these are more intrusive), so this patch does the same. Cc: Simon Horman <horms@verge.net.au> Cc: Eric Biederman <ebiederm@xmission.com> Cc: kexec@lists.infradead.org Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2017-05-22Handle additional e820 memmap type stringsEric DeVolder
Keep pace with changes to linux arch/x86/kernel/e820.c to function e820_type_to_string(). With this change, the following messages from kexec are eliminated (and allows kexec to load): Unknown type (Reserved) while parsing /sys/firmware/memmap/8/type. Please report this as bug. Using RANGE_RESERVED now. Unknown type (Unknown E820 type) while parsing /sys/firmware/memmap/4/type. Please report this as bug. Using RANGE_RESERVED now. Signed-off-by: Eric DeVolder <eric.devolder@oracle.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-09-02Add persistent memory supportBaoquan He
Kernel add E820_PRAM or E820_PMEM type for NVDIMM memory device. Now support them in kexec too. Reported-by: Toshi Kani <toshi.kani@hp.com> Tested-by: Toshi Kani <toshi.kani@hp.com> Signed-off-by: Baoquan He <bhe@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2014-04-23x86, cleanup: kexec memory range .end to be inclusiveWANG Chao
Later kexec and kdump memory range will be mapped to E820entry. But currently kexec memory range .end field is exclusive while crash memory range is inclusive. Given the fact that the exported proc iomem and sysfs memmap are both inclusive, change kexec memory range .end to be inclusive. Later the unified memory range of both kexec and kdump can use the same E820 filling code. Signed-off-by: WANG Chao <chaowang@redhat.com> Acked-by: Dave Young <dyoung@redhat.com> Tested-by: Linn Crosetto <linn@hp.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2011-08-22kexec: Export compare_ranges() function from firmware_memmap.c moduleDaniel Kiper
Export compare_ranges() function from firmware_memmap.c module. It is generic function and it could be used by other modules. Signed-off-by: Daniel Kiper <dkiper@net-space.pl> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-06-18kexec: Unusable memory range typeCliff Wickman
On SGI UV (x86_64) kexec grumbles about 'Unusable memory' ranges: Unknown type (%s) while parsing %s. Please " "report this as bug. Using RANGE_RESERVED now. uv44-sys:~ # cat /proc/iomem 00000000-00000fff : System RAM 00001000-00005fff : reserved 00006000-0008efff : System RAM 0008f000-0008ffff : ACPI Non-volatile Storage 00090000-0009ffff : System RAM 00100000-75ffcfff : System RAM 01000000-0139dcaf : Kernel code 0139dcb0-0192c12f : Kernel data 01a28000-01cd7777 : Kernel bss 02000000-09ffffff : Crash kernel 75ffd000-76013fff : Unusable memory 76014000-766a6fff : System RAM 766a7000-766d6fff : Unusable memory ... This patch keeps Unusable memory as another RANGE_RESERVED area, but without the warning message. Diffed against git.kernel.org/pub/scm/linux/kernel/git/horms/kexec-tools.git Signed-off-by: Cliff Wickman <cpw@sgi.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-03-15kexec-tools: Fix unused return value warningsAmeya Palande
This patch fixes following warning: kexec/firmware_memmap.c: In function ‘parse_numeric_sysfs’: kexec/firmware_memmap.c:70: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result kexec/firmware_memmap.c: In function ‘parse_string_sysfs’: kexec/firmware_memmap.c:103: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result Difference between v1 and v2: Less indentation. Signed-off-by: Ameya Palande <ameya.palande@nokia.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-02-10Correct email addressesBernhard Walle
Since I don't work for SUSE any more and 'bwalle@suse.de' is invalid, correct it in the copyright so that people can still contact me. Signed-off-by: Bernhard Walle <bernhard.walle@gmx.de> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-09-24IA64: do not include uncached memory to vmcoreJay Lan
Currently a memory segment in memory map with attribute of EFI_MEMORY_UC is denoted as "System RAM" in /proc/iomem, while memory of attribute (EFI_MEMORY_WB|EFI_MEMORY_UC) is also labeled the same. The kexec utility then includes uncached memory as part of vmcore. The kdump kernel may MCA when it tries to save the vmcore to a disk. A normal "cached" access can cause MCAs. Since kexec assembled memory ranges with memory tagged as "System RAM", the uncached memory will be excluded if it is labeled differently. Simon, since only IA64 will create "Uncached RAM" label, i do not make changes to other arch. Our HP machine in the lab is dead. I am sorry that i can not test against other IA64 systems (than SGI's). Feedback is very much appreciated. The corresponding kernel patch is needed to test this kexec patch: http://marc.info/?l=linux-ia64&m=122122791230130&w=2 This patch without the kernel patch will have no effect and do no harm. The kernel patch has been commited as "[IA64] kexec fails on systems with blocks of uncached memory". Signed-off-by: Jay Lan <jlan@sgi.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-09-12Fix build warningsGeoff Levand
Fix these 64 bit build warnings: kexec/firmware_memmap.c:241: warning: format '%d' expects type 'int', but argument 3 has type 'size_t' kexec/crashdump-elf.c:160: warning: format '%llx' expects type 'long long unsigned int', but argument 4 has type 'Elf64_Off' kexec/crashdump-elf.c:160: warning: format '%llx' expects type 'long long unsigned int', but argument 5 has type 'Elf64_Addr' kexec/crashdump-elf.c:160: warning: format '%llx' expects type 'long long unsigned int', but argument 6 has type 'Elf64_Addr' kexec/crashdump-elf.c:160: warning: format '%llx' expects type 'long long unsigned int', but argument 7 has type 'Elf64_Xword' kexec/crashdump-elf.c:160: warning: format '%llx' expects type 'long long unsigned int', but argument 8 has type 'Elf64_Xword' Tested on PS3 (ppc64) with 32 and 64 bit builds. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-07-11Parse /sys/firmware/memmap.Bernhard Walle
After the patch that provides /sys/firmware/memmap has been merged in the 'tip' tree by Ingo Molnar, kexec should use that interface. This patch implements architecture-independent parsing in a new file called firmware_memmap.c. The x86 part is ported to use that memory map for kexec. We don't use that memory map for building the ELF core headers, that was the intention for that new interface. Signed-off-by: Bernhard Walle <bwalle@suse.de> Signed-off-by: Simon Horman <horms@verge.net.au>