From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH V2 3/4] x86/kvm: Resolve shadow warnings in macro expansion Date: Thu, 31 Jul 2014 13:50:42 +0200 Message-ID: <53DA2D92.2010301@redhat.com> References: <1406294825-21393-3-git-send-email-jeffrey.t.kirsher@intel.com> <20140730211926.127150.102.stgit@mdrustad-wks.jf.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: jeffrey.t.kirsher@intel.com, kvm@vger.kernel.org To: Mark D Rustad , gleb@kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:31958 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750774AbaGaLvE (ORCPT ); Thu, 31 Jul 2014 07:51:04 -0400 In-Reply-To: <20140730211926.127150.102.stgit@mdrustad-wks.jf.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: Il 30/07/2014 23:19, Mark D Rustad ha scritto: > Resolve shadow warnings that appear in W=2 builds. Instead of > using ret to hold the return pointer, save the length in a new > variable saved_len and compute the pointer on exit. This also > resolves a very technical error, in that ret was declared as > a const char *, when it really was a char * const, which > theoretically could have allowed the compiler to do something > wrong. > > Signed-off-by: Mark Rustad > Signed-off-by: Jeff Kirsher > > --- > Changes in V2: > - Instead of renaming all inner variables, just delete the > ret variable in favor of the new saved_len variable. > --- > arch/x86/kvm/mmutrace.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/kvm/mmutrace.h b/arch/x86/kvm/mmutrace.h > index 9d2e0ffcb190..5aaf35641768 100644 > --- a/arch/x86/kvm/mmutrace.h > +++ b/arch/x86/kvm/mmutrace.h > @@ -22,7 +22,7 @@ > __entry->unsync = sp->unsync; > > #define KVM_MMU_PAGE_PRINTK() ({ \ > - const char *ret = p->buffer + p->len; \ > + const u32 saved_len = p->len; \ > static const char *access_str[] = { \ > "---", "--x", "w--", "w-x", "-u-", "-ux", "wu-", "wux" \ > }; \ > @@ -41,7 +41,7 @@ > role.nxe ? "" : "!", \ > __entry->root_count, \ > __entry->unsync ? "unsync" : "sync", 0); \ > - ret; \ > + p->buffer + saved_len; \ > }) > > #define kvm_mmu_trace_pferr_flags \ > Applying this patch, thanks. Paolo