lkml.org 
[lkml]   [2021]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@quicinc.com>
> ---

Reviewed-by: Sean Christopherson <seanjc@google.com>

\
 
 \ /
  Last update: 2021-10-27 16:23    [W:0.281 / U:0.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site