* arch/s390/kvm/kvm-s390.c:5659 kvm_arch_prepare_memory_region() error: we previously assumed 'new' could be null (see line 5645)
@ 2026-05-12 10:48 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-05-12 10:48 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Claudio Imbrenda <imbrenda@linux.ibm.com>
CC: Steffen Eiden <seiden@linux.ibm.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 50897c955902c93ae71c38698abb910525ebdc89
commit: 9b8e8aad5896d66005d29920cb1643076a20b172 KVM: s390: ucontrol: Fix memslot handling
date: 5 weeks ago
:::::: branch date: 12 hours ago
:::::: commit date: 5 weeks ago
config: s390-randconfig-r073-20260512 (https://download.01.org/0day-ci/archive/20260512/202605121849.vHgrQKWJ-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 8.5.0
smatch: v0.5.0-9065-ge9cc34fd
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
| Fixes: 9b8e8aad5896 ("KVM: s390: ucontrol: Fix memslot handling")
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202605121849.vHgrQKWJ-lkp@intel.com/
smatch warnings:
arch/s390/kvm/kvm-s390.c:5659 kvm_arch_prepare_memory_region() error: we previously assumed 'new' could be null (see line 5645)
vim +/new +5659 arch/s390/kvm/kvm-s390.c
d663b8a28598607 Paolo Bonzini 2022-11-03 5638
b0c632db637d68a Heiko Carstens 2008-03-25 5639 /* Section: memory related */
f7784b8ec9b6a04 Marcelo Tosatti 2009-12-23 5640 int kvm_arch_prepare_memory_region(struct kvm *kvm,
537a17b31493009 Sean Christopherson 2021-12-06 5641 const struct kvm_memory_slot *old,
537a17b31493009 Sean Christopherson 2021-12-06 5642 struct kvm_memory_slot *new,
7b6195a91d60909 Takuya Yoshikawa 2013-02-27 5643 enum kvm_mr_change change)
b0c632db637d68a Heiko Carstens 2008-03-25 5644 {
9b8e8aad5896d66 Claudio Imbrenda 2026-04-02 @5645 if (kvm_is_ucontrol(kvm) && new && new->id < KVM_USER_MEM_SLOTS)
7816e58967d0e6c Christoph Schlameuss 2024-06-24 5646 return -EINVAL;
7816e58967d0e6c Christoph Schlameuss 2024-06-24 5647
ec5c86976674d2f Sean Christopherson 2021-12-06 5648 /* When we are protected, we should not change the memory slots */
ec5c86976674d2f Sean Christopherson 2021-12-06 5649 if (kvm_s390_pv_get_handle(kvm))
ec5c86976674d2f Sean Christopherson 2021-12-06 5650 return -EINVAL;
ec5c86976674d2f Sean Christopherson 2021-12-06 5651
f2d3155e2a6bac4 Nico Boehr 2023-01-27 5652 if (change != KVM_MR_DELETE && change != KVM_MR_FLAGS_ONLY) {
f2d3155e2a6bac4 Nico Boehr 2023-01-27 5653 /*
06a20c3ab6042ea Claudio Imbrenda 2026-04-02 5654 * A few sanity checks. The memory in userland is ok to be
06a20c3ab6042ea Claudio Imbrenda 2026-04-02 5655 * fragmented into various different vmas. It is okay to mmap()
06a20c3ab6042ea Claudio Imbrenda 2026-04-02 5656 * and munmap() stuff in this slot after doing this call at any
06a20c3ab6042ea Claudio Imbrenda 2026-04-02 5657 * time.
f2d3155e2a6bac4 Nico Boehr 2023-01-27 5658 */
06a20c3ab6042ea Claudio Imbrenda 2026-04-02 @5659 if (new->userspace_addr & ~PAGE_MASK)
b0c632db637d68a Heiko Carstens 2008-03-25 5660 return -EINVAL;
06a20c3ab6042ea Claudio Imbrenda 2026-04-02 5661 if ((new->base_gfn + new->npages) * PAGE_SIZE > kvm->arch.mem_limit)
a3a92c31bf0b57a Dominik Dingel 2014-12-01 5662 return -EINVAL;
f2d3155e2a6bac4 Nico Boehr 2023-01-27 5663 }
f2d3155e2a6bac4 Nico Boehr 2023-01-27 5664
f2d3155e2a6bac4 Nico Boehr 2023-01-27 5665 if (!kvm->arch.migration_mode)
f2d3155e2a6bac4 Nico Boehr 2023-01-27 5666 return 0;
f2d3155e2a6bac4 Nico Boehr 2023-01-27 5667
f2d3155e2a6bac4 Nico Boehr 2023-01-27 5668 /*
f2d3155e2a6bac4 Nico Boehr 2023-01-27 5669 * Turn off migration mode when:
f2d3155e2a6bac4 Nico Boehr 2023-01-27 5670 * - userspace creates a new memslot with dirty logging off,
f2d3155e2a6bac4 Nico Boehr 2023-01-27 5671 * - userspace modifies an existing memslot (MOVE or FLAGS_ONLY) and
f2d3155e2a6bac4 Nico Boehr 2023-01-27 5672 * dirty logging is turned off.
f2d3155e2a6bac4 Nico Boehr 2023-01-27 5673 * Migration mode expects dirty page logging being enabled to store
f2d3155e2a6bac4 Nico Boehr 2023-01-27 5674 * its dirty bitmap.
f2d3155e2a6bac4 Nico Boehr 2023-01-27 5675 */
f2d3155e2a6bac4 Nico Boehr 2023-01-27 5676 if (change != KVM_MR_DELETE &&
f2d3155e2a6bac4 Nico Boehr 2023-01-27 5677 !(new->flags & KVM_MEM_LOG_DIRTY_PAGES))
f2d3155e2a6bac4 Nico Boehr 2023-01-27 5678 WARN(kvm_s390_vm_stop_migration(kvm),
f2d3155e2a6bac4 Nico Boehr 2023-01-27 5679 "Failed to stop migration mode");
a3a92c31bf0b57a Dominik Dingel 2014-12-01 5680
f7784b8ec9b6a04 Marcelo Tosatti 2009-12-23 5681 return 0;
f7784b8ec9b6a04 Marcelo Tosatti 2009-12-23 5682 }
f7784b8ec9b6a04 Marcelo Tosatti 2009-12-23 5683
:::::: The code at line 5659 was first introduced by commit
:::::: 06a20c3ab6042ea7f9927fbeb50aa4e79894c136 KVM: s390: Allow 4k granularity for memslots
:::::: TO: Claudio Imbrenda <imbrenda@linux.ibm.com>
:::::: CC: Claudio Imbrenda <imbrenda@linux.ibm.com>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-05-12 10:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12 10:48 arch/s390/kvm/kvm-s390.c:5659 kvm_arch_prepare_memory_region() error: we previously assumed 'new' could be null (see line 5645) kernel test robot
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.