CC: [email protected]
CC: [email protected]
TO: Joerg Roedel <[email protected]>
CC: Paolo Bonzini <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   79ca035d2d941839f55f3b8b69f8e81c66946ed8
commit: eaf78265a4ab33935d3a0f1407ce4a91aac4d4d5 KVM: SVM: Move SEV code to 
separate file
date:   10 weeks ago
:::::: branch date: 2 hours ago
:::::: commit date: 10 weeks ago
config: x86_64-randconfig-m001-20200611 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

smatch warnings:
arch/x86/kvm/svm/sev.c:982 svm_register_enc_region() warn: impossible condition 
'(range->addr > (~0)) => (0-u64max > u64max)'
arch/x86/kvm/svm/sev.c:982 svm_register_enc_region() warn: impossible condition 
'(range->size > (~0)) => (0-u64max > u64max)'

# 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eaf78265a4ab33935d3a0f1407ce4a91aac4d4d5
git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git remote update linus
git checkout eaf78265a4ab33935d3a0f1407ce4a91aac4d4d5
vim +982 arch/x86/kvm/svm/sev.c

eaf78265a4ab33 Joerg Roedel 2020-03-24   971  
eaf78265a4ab33 Joerg Roedel 2020-03-24   972  int 
svm_register_enc_region(struct kvm *kvm,
eaf78265a4ab33 Joerg Roedel 2020-03-24   973                        struct 
kvm_enc_region *range)
eaf78265a4ab33 Joerg Roedel 2020-03-24   974  {
eaf78265a4ab33 Joerg Roedel 2020-03-24   975    struct kvm_sev_info *sev = 
&to_kvm_svm(kvm)->sev_info;
eaf78265a4ab33 Joerg Roedel 2020-03-24   976    struct enc_region *region;
eaf78265a4ab33 Joerg Roedel 2020-03-24   977    int ret = 0;
eaf78265a4ab33 Joerg Roedel 2020-03-24   978  
eaf78265a4ab33 Joerg Roedel 2020-03-24   979    if (!sev_guest(kvm))
eaf78265a4ab33 Joerg Roedel 2020-03-24   980            return -ENOTTY;
eaf78265a4ab33 Joerg Roedel 2020-03-24   981  
eaf78265a4ab33 Joerg Roedel 2020-03-24  @982    if (range->addr > ULONG_MAX || 
range->size > ULONG_MAX)
eaf78265a4ab33 Joerg Roedel 2020-03-24   983            return -EINVAL;
eaf78265a4ab33 Joerg Roedel 2020-03-24   984  
eaf78265a4ab33 Joerg Roedel 2020-03-24   985    region = 
kzalloc(sizeof(*region), GFP_KERNEL_ACCOUNT);
eaf78265a4ab33 Joerg Roedel 2020-03-24   986    if (!region)
eaf78265a4ab33 Joerg Roedel 2020-03-24   987            return -ENOMEM;
eaf78265a4ab33 Joerg Roedel 2020-03-24   988  
eaf78265a4ab33 Joerg Roedel 2020-03-24   989    region->pages = 
sev_pin_memory(kvm, range->addr, range->size, &region->npages, 1);
eaf78265a4ab33 Joerg Roedel 2020-03-24   990    if (!region->pages) {
eaf78265a4ab33 Joerg Roedel 2020-03-24   991            ret = -ENOMEM;
eaf78265a4ab33 Joerg Roedel 2020-03-24   992            goto e_free;
eaf78265a4ab33 Joerg Roedel 2020-03-24   993    }
eaf78265a4ab33 Joerg Roedel 2020-03-24   994  
eaf78265a4ab33 Joerg Roedel 2020-03-24   995    /*
eaf78265a4ab33 Joerg Roedel 2020-03-24   996     * The guest may change the 
memory encryption attribute from C=0 -> C=1
eaf78265a4ab33 Joerg Roedel 2020-03-24   997     * or vice versa for this 
memory range. Lets make sure caches are
eaf78265a4ab33 Joerg Roedel 2020-03-24   998     * flushed to ensure that guest 
data gets written into memory with
eaf78265a4ab33 Joerg Roedel 2020-03-24   999     * correct C-bit.
eaf78265a4ab33 Joerg Roedel 2020-03-24  1000     */
eaf78265a4ab33 Joerg Roedel 2020-03-24  1001    
sev_clflush_pages(region->pages, region->npages);
eaf78265a4ab33 Joerg Roedel 2020-03-24  1002  
eaf78265a4ab33 Joerg Roedel 2020-03-24  1003    region->uaddr = range->addr;
eaf78265a4ab33 Joerg Roedel 2020-03-24  1004    region->size = range->size;
eaf78265a4ab33 Joerg Roedel 2020-03-24  1005  
eaf78265a4ab33 Joerg Roedel 2020-03-24  1006    mutex_lock(&kvm->lock);
eaf78265a4ab33 Joerg Roedel 2020-03-24  1007    list_add_tail(&region->list, 
&sev->regions_list);
eaf78265a4ab33 Joerg Roedel 2020-03-24  1008    mutex_unlock(&kvm->lock);
eaf78265a4ab33 Joerg Roedel 2020-03-24  1009  
eaf78265a4ab33 Joerg Roedel 2020-03-24  1010    return ret;
eaf78265a4ab33 Joerg Roedel 2020-03-24  1011  
eaf78265a4ab33 Joerg Roedel 2020-03-24  1012  e_free:
eaf78265a4ab33 Joerg Roedel 2020-03-24  1013    kfree(region);
eaf78265a4ab33 Joerg Roedel 2020-03-24  1014    return ret;
eaf78265a4ab33 Joerg Roedel 2020-03-24  1015  }
eaf78265a4ab33 Joerg Roedel 2020-03-24  1016  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to