Skip to contentSkip to conversation

arch/s390/kvm/../../../virt/kvm/kvm_main.c:2710:23: warning: variable 'end' set but not used

PATCH New Dan Carpenter 1 participant 1 message Jan 8, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 9/11 arch/s390/kvm/../../../virt/kvm/kvm_main.c:2710:23: warning: variable 'end' set but not used

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kas/linux.git  kvm-unmapped-memfd-secret
head:   ee93fab5627b827e7893a071dc59b26782eb8b28
commit: d922017493326641248b7c74b713e33f14bc8c5a [9/11] KVM: Handle secretmem
config: s390-randconfig-s031-20210108 (attached as .config)
compiler: s390-linux-gcc (GCC) 9.3.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-208-g46a52ca4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/kas/linux.git/commit/?id=d922017493326641248b7c74b713e33f14bc8c5a
git remote add kas https://git.kernel.org/pub/scm/linux/kernel/git/kas/linux.git
git fetch --no-tags kas kvm-unmapped-memfd-secret
git checkout d922017493326641248b7c74b713e33f14bc8c5a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=s390

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

arch/s390/kvm/../../../virt/kvm/kvm_main.c: In function 'kvm_share_memory':

Quoted 1 line
Quoted 1 line

arch/s390/kvm/../../../virt/kvm/kvm_main.c:2710:23: warning: variable 'end' set but not used [-Wunused-but-set-variable]

    2710 |  unsigned long start, end;
         |                       ^~~

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for SKB_EXTENSIONS Depends on NET
Selected by
- KCOV && ARCH_HAS_KCOV && (CC_HAS_SANCOV_TRACE_PC || GCC_PLUGINS

"sparse warnings: (new ones prefixed by >>)"

Quoted 1 line
Quoted 1 line

arch/s390/kvm/../../../virt/kvm/kvm_main.c:2188:21: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *hva @@ got void [noderef] __iomem * @@

arch/s390/kvm/../../../virt/kvm/kvm_main.c:2188:21: sparse: expected void *hva
arch/s390/kvm/../../../virt/kvm/kvm_main.c:2188:21: sparse: got void [noderef] __iomem *

Quoted 1 line
Quoted 1 line

arch/s390/kvm/../../../virt/kvm/kvm_main.c:2242:28: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *hva @@

arch/s390/kvm/../../../virt/kvm/kvm_main.c:2242:28: sparse: expected void volatile [noderef] __iomem *addr
arch/s390/kvm/../../../virt/kvm/kvm_main.c:2242:28: sparse: got void *hva

vim +/end +2710 arch/s390/kvm/../../../virt/kvm/kvm_main.c

d922017493326641 Kirill A. Shutemov 2021-01-04  2707  int kvm_share_memory(struct kvm *kvm, unsigned long gfn, unsigned long npages)
d922017493326641 Kirill A. Shutemov 2021-01-04  2708  {
d922017493326641 Kirill A. Shutemov 2021-01-04  2709  	struct kvm_memory_slot *memslot;
d922017493326641 Kirill A. Shutemov 2021-01-04 @2710  	unsigned long start, end;
d922017493326641 Kirill A. Shutemov 2021-01-04  2711  	gfn_t numpages;
d922017493326641 Kirill A. Shutemov 2021-01-04  2712  	unsigned long ret;
d922017493326641 Kirill A. Shutemov 2021-01-04  2713  
d922017493326641 Kirill A. Shutemov 2021-01-04  2714  	if (!npages)
d922017493326641 Kirill A. Shutemov 2021-01-04  2715  		return 0;
d922017493326641 Kirill A. Shutemov 2021-01-04  2716  
d922017493326641 Kirill A. Shutemov 2021-01-04  2717  	memslot = gfn_to_memslot(kvm, gfn);
d922017493326641 Kirill A. Shutemov 2021-01-04  2718  	/* Not backed by memory. It's okay. */
d922017493326641 Kirill A. Shutemov 2021-01-04  2719  	if (!memslot)
d922017493326641 Kirill A. Shutemov 2021-01-04  2720  		return 0;
d922017493326641 Kirill A. Shutemov 2021-01-04  2721  
d922017493326641 Kirill A. Shutemov 2021-01-04  2722  	start = gfn_to_hva_many(memslot, gfn, &numpages);
d922017493326641 Kirill A. Shutemov 2021-01-04  2723  	if (kvm_is_error_hva(start))
d922017493326641 Kirill A. Shutemov 2021-01-04  2724  		return -KVM_EINVAL;
d922017493326641 Kirill A. Shutemov 2021-01-04  2725  	end = start + npages * PAGE_SIZE;
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Assignment is never used.

d922017493326641 Kirill A. Shutemov 2021-01-04  2726  
d922017493326641 Kirill A. Shutemov 2021-01-04  2727  	/* XXX: Share range across memory slots? */
d922017493326641 Kirill A. Shutemov 2021-01-04  2728  	if (WARN_ON(numpages < npages))
d922017493326641 Kirill A. Shutemov 2021-01-04  2729  		return -KVM_EINVAL;
d922017493326641 Kirill A. Shutemov 2021-01-04  2730  
d922017493326641 Kirill A. Shutemov 2021-01-04  2731  	ret = vm_mmap(NULL, start, npages * PAGE_SIZE, PROT_READ | PROT_WRITE,
d922017493326641 Kirill A. Shutemov 2021-01-04  2732  		      MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, 0);
d922017493326641 Kirill A. Shutemov 2021-01-04  2733  	if (ret != start)
d922017493326641 Kirill A. Shutemov 2021-01-04  2734  		return KVM_EFAULT;
d922017493326641 Kirill A. Shutemov 2021-01-04  2735  
d922017493326641 Kirill A. Shutemov 2021-01-04  2736  	return 0;
d922017493326641 Kirill A. Shutemov 2021-01-04  2737  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to [email protected]