From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: arch/powerpc/kexec/file_load_64.c:981 setup_new_fdt_ppc64() error: we previously assumed 'rmem' could be null (see line 977)
Date: Tue, 01 Dec 2020 13:36:11 +0800 [thread overview]
Message-ID: <202012011309.RhKMLqZU-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 7533 bytes --]
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Hari Bathini <hbathini@linux.ibm.com>
CC: Michael Ellerman <mpe@ellerman.id.au>
CC: Thiago Jung Bauermann <bauerman@linux.ibm.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b65054597872ce3aefbc6a666385eabdf9e288da
commit: 6ecd0163d36049b5f2435a8658f1320c9f3f2924 powerpc/kexec_file: Add appropriate regions for memory reserve map
date: 4 months ago
:::::: branch date: 30 hours ago
:::::: commit date: 4 months ago
config: powerpc64-randconfig-m031-20201201 (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
arch/powerpc/kexec/file_load_64.c:981 setup_new_fdt_ppc64() error: we previously assumed 'rmem' could be null (see line 977)
Old smatch warnings:
arch/powerpc/kexec/file_load_64.c:203 get_crash_memory_ranges() error: uninitialized symbol 'ret'.
vim +/rmem +981 arch/powerpc/kexec/file_load_64.c
19031275a58812 Hari Bathini 2020-07-29 911
19031275a58812 Hari Bathini 2020-07-29 912 /**
19031275a58812 Hari Bathini 2020-07-29 913 * setup_new_fdt_ppc64 - Update the flattend device-tree of the kernel
19031275a58812 Hari Bathini 2020-07-29 914 * being loaded.
19031275a58812 Hari Bathini 2020-07-29 915 * @image: kexec image being loaded.
19031275a58812 Hari Bathini 2020-07-29 916 * @fdt: Flattened device tree for the next kernel.
19031275a58812 Hari Bathini 2020-07-29 917 * @initrd_load_addr: Address where the next initrd will be loaded.
19031275a58812 Hari Bathini 2020-07-29 918 * @initrd_len: Size of the next initrd, or 0 if there will be none.
19031275a58812 Hari Bathini 2020-07-29 919 * @cmdline: Command line for the next kernel, or NULL if there will
19031275a58812 Hari Bathini 2020-07-29 920 * be none.
19031275a58812 Hari Bathini 2020-07-29 921 *
19031275a58812 Hari Bathini 2020-07-29 922 * Returns 0 on success, negative errno on error.
19031275a58812 Hari Bathini 2020-07-29 923 */
19031275a58812 Hari Bathini 2020-07-29 924 int setup_new_fdt_ppc64(const struct kimage *image, void *fdt,
19031275a58812 Hari Bathini 2020-07-29 925 unsigned long initrd_load_addr,
19031275a58812 Hari Bathini 2020-07-29 926 unsigned long initrd_len, const char *cmdline)
19031275a58812 Hari Bathini 2020-07-29 927 {
6ecd0163d36049 Hari Bathini 2020-07-29 928 struct crash_mem *umem = NULL, *rmem = NULL;
6ecd0163d36049 Hari Bathini 2020-07-29 929 int i, nr_ranges, ret;
7c64e21a1c5a5b Hari Bathini 2020-07-29 930
7c64e21a1c5a5b Hari Bathini 2020-07-29 931 ret = setup_new_fdt(image, fdt, initrd_load_addr, initrd_len, cmdline);
7c64e21a1c5a5b Hari Bathini 2020-07-29 932 if (ret)
7c64e21a1c5a5b Hari Bathini 2020-07-29 933 goto out;
7c64e21a1c5a5b Hari Bathini 2020-07-29 934
7c64e21a1c5a5b Hari Bathini 2020-07-29 935 /*
7c64e21a1c5a5b Hari Bathini 2020-07-29 936 * Restrict memory usage for kdump kernel by setting up
1a1cf93c200581 Hari Bathini 2020-07-29 937 * usable memory ranges and memory reserve map.
7c64e21a1c5a5b Hari Bathini 2020-07-29 938 */
7c64e21a1c5a5b Hari Bathini 2020-07-29 939 if (image->type == KEXEC_TYPE_CRASH) {
7c64e21a1c5a5b Hari Bathini 2020-07-29 940 ret = get_usable_memory_ranges(&umem);
7c64e21a1c5a5b Hari Bathini 2020-07-29 941 if (ret)
7c64e21a1c5a5b Hari Bathini 2020-07-29 942 goto out;
7c64e21a1c5a5b Hari Bathini 2020-07-29 943
7c64e21a1c5a5b Hari Bathini 2020-07-29 944 ret = update_usable_mem_fdt(fdt, umem);
7c64e21a1c5a5b Hari Bathini 2020-07-29 945 if (ret) {
7c64e21a1c5a5b Hari Bathini 2020-07-29 946 pr_err("Error setting up usable-memory property for kdump kernel\n");
7c64e21a1c5a5b Hari Bathini 2020-07-29 947 goto out;
7c64e21a1c5a5b Hari Bathini 2020-07-29 948 }
7c64e21a1c5a5b Hari Bathini 2020-07-29 949
1a1cf93c200581 Hari Bathini 2020-07-29 950 /*
1a1cf93c200581 Hari Bathini 2020-07-29 951 * Ensure we don't touch crashed kernel's memory except the
1a1cf93c200581 Hari Bathini 2020-07-29 952 * first 64K of RAM, which will be backed up.
1a1cf93c200581 Hari Bathini 2020-07-29 953 */
1a1cf93c200581 Hari Bathini 2020-07-29 954 ret = fdt_add_mem_rsv(fdt, BACKUP_SRC_END + 1,
1a1cf93c200581 Hari Bathini 2020-07-29 955 crashk_res.start - BACKUP_SRC_SIZE);
7c64e21a1c5a5b Hari Bathini 2020-07-29 956 if (ret) {
7c64e21a1c5a5b Hari Bathini 2020-07-29 957 pr_err("Error reserving crash memory: %s\n",
7c64e21a1c5a5b Hari Bathini 2020-07-29 958 fdt_strerror(ret));
7c64e21a1c5a5b Hari Bathini 2020-07-29 959 goto out;
7c64e21a1c5a5b Hari Bathini 2020-07-29 960 }
1a1cf93c200581 Hari Bathini 2020-07-29 961
1a1cf93c200581 Hari Bathini 2020-07-29 962 /* Ensure backup region is not used by kdump/capture kernel */
1a1cf93c200581 Hari Bathini 2020-07-29 963 ret = fdt_add_mem_rsv(fdt, image->arch.backup_start,
1a1cf93c200581 Hari Bathini 2020-07-29 964 BACKUP_SRC_SIZE);
1a1cf93c200581 Hari Bathini 2020-07-29 965 if (ret) {
1a1cf93c200581 Hari Bathini 2020-07-29 966 pr_err("Error reserving memory for backup: %s\n",
1a1cf93c200581 Hari Bathini 2020-07-29 967 fdt_strerror(ret));
1a1cf93c200581 Hari Bathini 2020-07-29 968 goto out;
1a1cf93c200581 Hari Bathini 2020-07-29 969 }
7c64e21a1c5a5b Hari Bathini 2020-07-29 970 }
7c64e21a1c5a5b Hari Bathini 2020-07-29 971
6ecd0163d36049 Hari Bathini 2020-07-29 972 /* Update memory reserve map */
6ecd0163d36049 Hari Bathini 2020-07-29 973 ret = get_reserved_memory_ranges(&rmem);
6ecd0163d36049 Hari Bathini 2020-07-29 974 if (ret)
6ecd0163d36049 Hari Bathini 2020-07-29 975 goto out;
6ecd0163d36049 Hari Bathini 2020-07-29 976
6ecd0163d36049 Hari Bathini 2020-07-29 @977 nr_ranges = rmem ? rmem->nr_ranges : 0;
6ecd0163d36049 Hari Bathini 2020-07-29 978 for (i = 0; i < nr_ranges; i++) {
6ecd0163d36049 Hari Bathini 2020-07-29 979 u64 base, size;
6ecd0163d36049 Hari Bathini 2020-07-29 980
6ecd0163d36049 Hari Bathini 2020-07-29 @981 base = rmem->ranges[i].start;
6ecd0163d36049 Hari Bathini 2020-07-29 982 size = rmem->ranges[i].end - base + 1;
6ecd0163d36049 Hari Bathini 2020-07-29 983 ret = fdt_add_mem_rsv(fdt, base, size);
6ecd0163d36049 Hari Bathini 2020-07-29 984 if (ret) {
6ecd0163d36049 Hari Bathini 2020-07-29 985 pr_err("Error updating memory reserve map: %s\n",
6ecd0163d36049 Hari Bathini 2020-07-29 986 fdt_strerror(ret));
6ecd0163d36049 Hari Bathini 2020-07-29 987 goto out;
6ecd0163d36049 Hari Bathini 2020-07-29 988 }
6ecd0163d36049 Hari Bathini 2020-07-29 989 }
6ecd0163d36049 Hari Bathini 2020-07-29 990
7c64e21a1c5a5b Hari Bathini 2020-07-29 991 out:
6ecd0163d36049 Hari Bathini 2020-07-29 992 kfree(rmem);
7c64e21a1c5a5b Hari Bathini 2020-07-29 993 kfree(umem);
7c64e21a1c5a5b Hari Bathini 2020-07-29 994 return ret;
19031275a58812 Hari Bathini 2020-07-29 995 }
19031275a58812 Hari Bathini 2020-07-29 996
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 26360 bytes --]
next reply other threads:[~2020-12-01 5:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-01 5:36 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-06-22 9:39 arch/powerpc/kexec/file_load_64.c:981 setup_new_fdt_ppc64() error: we previously assumed 'rmem' could be null (see line 977) kernel test robot
2021-03-20 2:00 kernel test robot
2021-02-27 7:19 kernel test robot
2020-10-30 15:55 kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202012011309.RhKMLqZU-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.