[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YXlguTLnOuEphLiZ@google.com>
Date: Wed, 27 Oct 2021 14:22:49 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Qian Cai <quic_qiancai@...cinc.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] kvm: Avoid shadowing a local in search_memslots()
On Tue, Oct 26, 2021, Qian Cai wrote:
> It is less error-prone to use a different variable name from the existing
> one in a wider scope. This is also flagged by GCC (W=2):
>
> ./include/linux/kvm_host.h: In function 'search_memslots':
> ./include/linux/kvm_host.h:1246:7: warning: declaration of 'slot' shadows a previous local [-Wshadow]
> 1246 | int slot = start + (end - start) / 2;
> | ^~~~
> ./include/linux/kvm_host.h:1240:26: note: shadowed declaration is here
> 1240 | struct kvm_memory_slot *slot;
> | ^~~~
>
> Signed-off-by: Qian Cai <quic_qiancai@...cinc.com>
> ---
Reviewed-by: Sean Christopherson <seanjc@...gle.com>
Powered by blists - more mailing lists