From mboxrd@z Thu Jan 1 00:00:00 1970 From: Brijesh Singh Subject: Re: [Part2 PATCH v6 32/38] KVM: SVM: Add support for SEV DEBUG_DECRYPT command Date: Mon, 30 Oct 2017 08:56:13 -0500 Message-ID: <5e041a3f-823f-08ce-a653-a02b71e2cb6b@amd.com> References: <20171020023413.122280-1-brijesh.singh@amd.com> <20171020023413.122280-33-brijesh.singh@amd.com> <20171027202518.GS12039@nazgul.tnic> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: brijesh.singh@amd.com, kvm@vger.kernel.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Joerg Roedel , Tom Lendacky , x86@kernel.org, linux-kernel@vger.kernel.org To: Borislav Petkov Return-path: In-Reply-To: <20171027202518.GS12039@nazgul.tnic> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org 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