[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202401111950.8fPaoThk-lkp@intel.com>
Date: Thu, 11 Jan 2024 20:27:22 +0800
From: kernel test robot <lkp@...el.com>
To: Ignat Korchagin <ignat@...udflare.com>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Linux Memory Management List <linux-mm@...ck.org>,
Baoquan He <bhe@...hat.com>
Subject: arch/arm/kernel/machine_kexec.c:62:23: sparse: sparse: cast removes
address space '__user' of expression
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: de927f6c0b07d9e698416c5b287c521b07694cac
commit: c41bd2514184d75db087fe4c1221237fb7922875 kexec: drop dependency on ARCH_SUPPORTS_KEXEC from CRASH_DUMP
date: 4 weeks ago
config: arm-randconfig-r026-20230703
compiler: arm-linux-gnueabi-gcc (GCC) 12.3.0
reproduce:
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401111950.8fPaoThk-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> arch/arm/kernel/machine_kexec.c:62:23: sparse: sparse: cast removes address space '__user' of expression
>> arch/arm/kernel/machine_kexec.c:62:23: sparse: sparse: cast removes address space '__user' of expression
arch/arm/kernel/machine_kexec.c:62:23: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got restricted __be32 [usertype] * @@
arch/arm/kernel/machine_kexec.c:62:23: sparse: expected void const volatile [noderef] __user *ptr
arch/arm/kernel/machine_kexec.c:62:23: sparse: got restricted __be32 [usertype] *
>> arch/arm/kernel/machine_kexec.c:62:23: sparse: sparse: cast removes address space '__user' of expression
>> arch/arm/kernel/machine_kexec.c:62:23: sparse: sparse: cast removes address space '__user' of expression
>> arch/arm/kernel/machine_kexec.c:62:23: sparse: sparse: cast to restricted __be32
vim +/__user +62 arch/arm/kernel/machine_kexec.c
b23065313297e7 Per Fransson 2010-12-03 27
c587e4a6a4d808 Richard Purdie 2007-02-06 28 /*
c587e4a6a4d808 Richard Purdie 2007-02-06 29 * Provide a dummy crash_notes definition while crash dump arrives to arm.
c587e4a6a4d808 Richard Purdie 2007-02-06 30 * This prevents breakage of crash_notes attribute in kernel/ksysfs.c.
c587e4a6a4d808 Richard Purdie 2007-02-06 31 */
c587e4a6a4d808 Richard Purdie 2007-02-06 32
c587e4a6a4d808 Richard Purdie 2007-02-06 33 int machine_kexec_prepare(struct kimage *image)
c587e4a6a4d808 Richard Purdie 2007-02-06 34 {
4cabd1d9625c7d Matthew Leach 2012-09-21 35 struct kexec_segment *current_segment;
4cabd1d9625c7d Matthew Leach 2012-09-21 36 __be32 header;
4cabd1d9625c7d Matthew Leach 2012-09-21 37 int i, err;
4cabd1d9625c7d Matthew Leach 2012-09-21 38
0d70262a2d6088 Russell King 2017-07-19 39 image->arch.kernel_r2 = image->start - KEXEC_ARM_ZIMAGE_OFFSET
0d70262a2d6088 Russell King 2017-07-19 40 + KEXEC_ARM_ATAGS_OFFSET;
0d70262a2d6088 Russell King 2017-07-19 41
2103f6cba61a8b Stephen Warren 2013-08-02 42 /*
2103f6cba61a8b Stephen Warren 2013-08-02 43 * Validate that if the current HW supports SMP, then the SW supports
2103f6cba61a8b Stephen Warren 2013-08-02 44 * and implements CPU hotplug for the current HW. If not, we won't be
2103f6cba61a8b Stephen Warren 2013-08-02 45 * able to kexec reliably, so fail the prepare operation.
2103f6cba61a8b Stephen Warren 2013-08-02 46 */
fee3fd4fd2ad13 Geert Uytterhoeven 2015-04-01 47 if (num_possible_cpus() > 1 && platform_can_secondary_boot() &&
fee3fd4fd2ad13 Geert Uytterhoeven 2015-04-01 48 !platform_can_cpu_hotplug())
2103f6cba61a8b Stephen Warren 2013-08-02 49 return -EINVAL;
2103f6cba61a8b Stephen Warren 2013-08-02 50
4cabd1d9625c7d Matthew Leach 2012-09-21 51 /*
4cabd1d9625c7d Matthew Leach 2012-09-21 52 * No segment at default ATAGs address. try to locate
4cabd1d9625c7d Matthew Leach 2012-09-21 53 * a dtb using magic.
4cabd1d9625c7d Matthew Leach 2012-09-21 54 */
4cabd1d9625c7d Matthew Leach 2012-09-21 55 for (i = 0; i < image->nr_segments; i++) {
4cabd1d9625c7d Matthew Leach 2012-09-21 56 current_segment = &image->segment[i];
4cabd1d9625c7d Matthew Leach 2012-09-21 57
0719392a61a9db Russell King 2016-08-02 58 if (!memblock_is_region_memory(idmap_to_phys(current_segment->mem),
2456f44dd7a9aa Aaro Koskinen 2012-10-16 59 current_segment->memsz))
c564df4db85aac Matthew Leach 2012-09-21 60 return -EINVAL;
c564df4db85aac Matthew Leach 2012-09-21 61
4cabd1d9625c7d Matthew Leach 2012-09-21 @62 err = get_user(header, (__be32*)current_segment->buf);
4cabd1d9625c7d Matthew Leach 2012-09-21 63 if (err)
4cabd1d9625c7d Matthew Leach 2012-09-21 64 return err;
4cabd1d9625c7d Matthew Leach 2012-09-21 65
0d70262a2d6088 Russell King 2017-07-19 66 if (header == cpu_to_be32(OF_DT_HEADER))
0d70262a2d6088 Russell King 2017-07-19 67 image->arch.kernel_r2 = current_segment->mem;
4cabd1d9625c7d Matthew Leach 2012-09-21 68 }
c587e4a6a4d808 Richard Purdie 2007-02-06 69 return 0;
c587e4a6a4d808 Richard Purdie 2007-02-06 70 }
c587e4a6a4d808 Richard Purdie 2007-02-06 71
:::::: The code at line 62 was first introduced by commit
:::::: 4cabd1d9625c7d88acd143f4021fbef75394f154 ARM: 7539/1: kexec: scan for dtb magic in segments
:::::: TO: Matthew Leach <matthew.leach@....com>
:::::: CC: Russell King <rmk+kernel@....linux.org.uk>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
View attachment "reproduce" of type "text/plain" (1041 bytes)
View attachment "config" of type "text/plain" (143500 bytes)
Powered by blists - more mailing lists