Re: [Part2 PATCH v6 32/38] KVM: SVM: Add support for SEV DEBUG_DECRYPT command

From: Brijesh Singh
Date: Mon Oct 30 2017 - 09:56:23 EST




On 10/27/17 3:25 PM, Borislav Petkov wrote:

...

>> + ret = -EFAULT;
>> + } else {
>> + memcpy((void *)dst_kaddr, page_address(tpage) + offset, size);
> arch/x86/kvm/svm.c: In function âsvm_mem_enc_opâ:
> arch/x86/kvm/svm.c:6115:4: warning: argument 1 null where non-null expected [-Wnonnull]
> memcpy((void *)dst_kaddr, page_address(tpage) + offset, size);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from ./arch/x86/include/asm/string.h:4:0,
> from ./include/linux/string.h:18,
> from ./include/linux/bitmap.h:8,
> from ./include/linux/cpumask.h:11,
> from ./arch/x86/include/asm/cpumask.h:4,
> from ./arch/x86/include/asm/msr.h:10,
> from ./arch/x86/include/asm/processor.h:20,
> from ./arch/x86/include/asm/cpufeature.h:4,
> from ./arch/x86/include/asm/thread_info.h:52,
> from ./include/linux/thread_info.h:37,
> from ./arch/x86/include/asm/preempt.h:6,
> from ./include/linux/preempt.h:80,
> from ./include/linux/hardirq.h:4,
> from ./include/linux/kvm_host.h:10,
> from arch/x86/kvm/svm.c:20:
> ./arch/x86/include/asm/string_64.h:31:14: note: in a call to function âmemcpyâ declared here
> extern void *memcpy(void *to, const void *from, size_t len);
> ^~~~~~
>

I am not able to reproduce the build warning in my setup, what config
option or compiler you are using to trigger this issue ? I am on
Fedora with gcc 6.4.x. Logically, the code looks okay. I can try to
rearrange code to fix the warning. I have not touched this function
since couple of rev, have u seen similar warning in previous versions
(v5, v4 etc). thanks

-Brijesh
Â