Re: [PATCH 8/9] KVM: Adjust seven checks for null pointers

From: kbuild test robot
Date: Sun Jan 22 2017 - 15:33:09 EST


Hi Markus,

[auto build test WARNING on kvm/linux-next]
[also build test WARNING on v4.10-rc4 next-20170120]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/SF-Markus-Elfring/KVM-Fine-tuning-for-several-function-implementations/20170123-022323
base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next
config: x86_64-allyesdebian (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All warnings (new ones prefixed by >>):

arch/x86/kvm/../../../virt/kvm/kvm_main.c: In function 'kvm_make_all_cpus_request':
>> arch/x86/kvm/../../../virt/kvm/kvm_main.c:187:7: warning: the address of 'cpus' will always evaluate as 'true' [-Waddress]
if (cpus && cpu != -1 && cpu != me &&
^~~~

vim +187 arch/x86/kvm/../../../virt/kvm/kvm_main.c

171 {
172 int i, cpu, me;
173 cpumask_var_t cpus;
174 bool called = true;
175 struct kvm_vcpu *vcpu;
176
177 zalloc_cpumask_var(&cpus, GFP_ATOMIC);
178
179 me = get_cpu();
180 kvm_for_each_vcpu(i, vcpu, kvm) {
181 kvm_make_request(req, vcpu);
182 cpu = vcpu->cpu;
183
184 /* Set ->requests bit before we read ->mode. */
185 smp_mb__after_atomic();
186
> 187 if (cpus && cpu != -1 && cpu != me &&
188 kvm_vcpu_exiting_guest_mode(vcpu) != OUTSIDE_GUEST_MODE)
189 cpumask_set_cpu(cpu, cpus);
190 }
191 if (unlikely(cpus == NULL))
192 smp_call_function_many(cpu_online_mask, ack_flush, NULL, 1);
193 else if (!cpumask_empty(cpus))
194 smp_call_function_many(cpus, ack_flush, NULL, 1);
195 else

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip