Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1564489 > unrolled thread
| Started by | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| First post | 2017-01-22 19:20 +0100 |
| Last post | 2017-01-23 10:40 +0100 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 8/9] KVM: Adjust seven checks for null pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-22 19:20 +0100
Re: [PATCH 8/9] KVM: Adjust seven checks for null pointers kbuild test robot <lkp@intel.com> - 2017-01-22 22:30 +0100
Re: [PATCH 8/9] KVM: Adjust seven checks for null pointers Dan Carpenter <dan.carpenter@oracle.com> - 2017-01-23 10:40 +0100
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-01-22 19:20 +0100 |
| Subject | [PATCH 8/9] KVM: Adjust seven checks for null pointers |
| Message-ID | <t2uUa-46y-19@gated-at.bofh.it> |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 22 Jan 2017 18:54:22 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The script "checkpatch.pl" pointed information out like the following.
Comparison to NULL could be written …
Thus fix affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
virt/kvm/kvm_main.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index ca88f3620ee3..4267a2c6f2aa 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -184,7 +184,7 @@ bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req)
/* Set ->requests bit before we read ->mode. */
smp_mb__after_atomic();
- if (cpus != NULL && cpu != -1 && cpu != me &&
+ if (cpus && cpu != -1 && cpu != me &&
kvm_vcpu_exiting_guest_mode(vcpu) != OUTSIDE_GUEST_MODE)
cpumask_set_cpu(cpu, cpus);
}
@@ -1532,10 +1532,9 @@ static kvm_pfn_t hva_to_pfn(unsigned long addr, bool atomic, bool *async,
retry:
vma = find_vma_intersection(current->mm, addr, addr + 1);
-
- if (vma == NULL)
+ if (!vma) {
pfn = KVM_PFN_ERR_FAULT;
- else if (vma->vm_flags & (VM_IO | VM_PFNMAP)) {
+ } else if (vma->vm_flags & (VM_IO | VM_PFNMAP)) {
r = hva_to_pfn_remapped(vma, addr, async, write_fault, &pfn);
if (r == -EAGAIN)
goto retry;
@@ -2835,7 +2834,7 @@ int kvm_register_device_ops(struct kvm_device_ops *ops, u32 type)
if (type >= ARRAY_SIZE(kvm_device_ops_table))
return -ENOSPC;
- if (kvm_device_ops_table[type] != NULL)
+ if (kvm_device_ops_table[type])
return -EEXIST;
kvm_device_ops_table[type] = ops;
@@ -2844,7 +2843,7 @@ int kvm_register_device_ops(struct kvm_device_ops *ops, u32 type)
void kvm_unregister_device_ops(u32 type)
{
- if (kvm_device_ops_table[type] != NULL)
+ if (kvm_device_ops_table[type])
kvm_device_ops_table[type] = NULL;
}
@@ -2860,7 +2859,7 @@ static int kvm_ioctl_create_device(struct kvm *kvm,
return -ENODEV;
ops = kvm_device_ops_table[cd->type];
- if (ops == NULL)
+ if (!ops)
return -ENODEV;
if (test)
@@ -3392,7 +3391,7 @@ static int kvm_io_bus_get_first_dev(struct kvm_io_bus *bus,
range = bsearch(&key, bus->range, bus->dev_count,
sizeof(struct kvm_io_range), kvm_io_bus_sort_cmp);
- if (range == NULL)
+ if (!range)
return -ENOENT;
off = range - bus->range;
@@ -3803,7 +3802,7 @@ static int kvm_init_debug(void)
struct kvm_stats_debugfs_item *p;
kvm_debugfs_dir = debugfs_create_dir("kvm", NULL);
- if (kvm_debugfs_dir == NULL)
+ if (!kvm_debugfs_dir)
goto out;
kvm_debugfs_num_entries = 0;
--
2.11.0
[toc] | [next] | [standalone]
| From | kbuild test robot <lkp@intel.com> |
|---|---|
| Date | 2017-01-22 22:30 +0100 |
| Message-ID | <t2xS2-5Ux-13@gated-at.bofh.it> |
| In reply to | #1564489 |
[Multipart message — attachments visible in raw view] — view raw
Hi Markus,
[auto build test ERROR on kvm/linux-next]
[also build test ERROR 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: mips-malta_kvm_defconfig (attached as .config)
compiler: mipsel-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips
All errors (new ones prefixed by >>):
arch/mips/kvm/../../../virt/kvm/kvm_main.c: In function 'kvm_make_all_cpus_request':
>> arch/mips/kvm/../../../virt/kvm/kvm_main.c:187:7: error: the address of 'cpus' will always evaluate as 'true' [-Werror=address]
if (cpus && cpu != -1 && cpu != me &&
^~~~
cc1: all warnings being treated as errors
vim +187 arch/mips/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
[toc] | [prev] | [next] | [standalone]
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Date | 2017-01-23 10:40 +0100 |
| Message-ID | <t2Jgu-4GV-15@gated-at.bofh.it> |
| In reply to | #1564489 |
Hm... GCC complains about "if (array)" but not about "if (array != NULL) ". I view this as a bug in GCC... But you should still be seeing these compile warnings. This is something like the 6th warning that kbuild has had to send you. regards, dan carpenter
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web