Skip to contentSkip to conversation

kvm: vgic: are these warnings wrong?

RFC AKASHI Takahiro 2 participants 4 messages Nov 14, 2017 – Nov 15, 2017

lore
Share & tools
lore
#0 lore raw

Hi Marc,

I've just run a static analyzer to v4.14.
While most of warnings/errors are false-positive, as you can easily imagine, there are something dubious. Can you please check ones below?

virt/kvm/arm/vgic/vgic-v3.c:352 vgic_v3_save_pending_tables() error: uninitialized symbol 'val'. virt/kvm/arm/vgic/vgic-its.c:424 its_sync_lpi_pending_table() error: uninitialized symbol 'pendmask'. virt/kvm/arm/vgic/vgic-its.c:779 vgic_its_alloc_collection() error: potential null dereference 'collection'. (kzalloc returns null) virt/kvm/arm/vgic/vgic-irqfd.c:115 kvm_vgic_setup_default_irq_routing() warn: double check that we're allocating correct size: 48 vs 64

# I believe that the messages here are self-describing.

Thanks,
-Takahiro AKASHI

#1 lore raw
Quoted 6 lines · AKASHI Takahiro

Hi Marc,

I've just run a static analyzer to v4.14.
While most of warnings/errors are false-positive, as you can easily imagine, there are something dubious. Can you please check ones below?

Quoted 6 lines

virt/kvm/arm/vgic/vgic-v3.c:352 vgic_v3_save_pending_tables() error: uninitialized symbol 'val'. virt/kvm/arm/vgic/vgic-its.c:424 its_sync_lpi_pending_table() error: uninitialized symbol 'pendmask'. virt/kvm/arm/vgic/vgic-its.c:779 vgic_its_alloc_collection() error: potential null dereference 'collection'. (kzalloc returns null) virt/kvm/arm/vgic/vgic-irqfd.c:115 kvm_vgic_setup_default_irq_routing() warn: double check that we're allocating correct size: 48 vs 64

# I believe that the messages here are self-describing.

Hi Takahiro,

All of these are pretty good findings... Out of curiosity, what is the tool you've been using?

Many thanks for reporting these bugs.

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#2 lore raw
Quoted 12 lines · Marc Zyngier
Quoted 11 lines · AKASHI Takahiro

Hi Marc,

I've just run a static analyzer to v4.14.
While most of warnings/errors are false-positive, as you can easily imagine, there are something dubious. Can you please check ones below?

virt/kvm/arm/vgic/vgic-v3.c:352 vgic_v3_save_pending_tables() error: uninitialized symbol 'val'. virt/kvm/arm/vgic/vgic-its.c:424 its_sync_lpi_pending_table() error: uninitialized symbol 'pendmask'. virt/kvm/arm/vgic/vgic-its.c:779 vgic_its_alloc_collection() error: potential null dereference 'collection'. (kzalloc returns null) virt/kvm/arm/vgic/vgic-irqfd.c:115 kvm_vgic_setup_default_irq_routing() warn: double check that we're allocating correct size: 48 vs 64

Quoted 6 lines
Quoted 1 line

# I believe that the messages here are self-describing.

Hi Takahiro,

All of these are pretty good findings... Out of curiosity, what is the tool you've been using?

smatch!
https://blogs.oracle.com/linuxkernel/smatch-static-analysis-tool-overview,-by-dan-carpenter

Quoted 1 line

Many thanks for reporting these bugs.

I want to find more bugs with such tools :) Just kidding.

-Takahiro AKASHI

Quoted 3 lines
	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#3 lore raw
In reply to AKASHI Takahiro
Quoted 6 lines · AKASHI Takahiro

Hi Marc,

I've just run a static analyzer to v4.14.
While most of warnings/errors are false-positive, as you can easily imagine, there are something dubious. Can you please check ones below?

Quoted 6 lines

virt/kvm/arm/vgic/vgic-v3.c:352 vgic_v3_save_pending_tables() error: uninitialized symbol 'val'. virt/kvm/arm/vgic/vgic-its.c:424 its_sync_lpi_pending_table() error: uninitialized symbol 'pendmask'. virt/kvm/arm/vgic/vgic-its.c:779 vgic_its_alloc_collection() error: potential null dereference 'collection'. (kzalloc returns null) virt/kvm/arm/vgic/vgic-irqfd.c:115 kvm_vgic_setup_default_irq_routing() warn: double check that we're allocating correct size: 48 vs 64

# I believe that the messages here are self-describing.

For the record, I've stashed fixes for these here[1], based on kvmarm/next.

Thanks,

	M.

[1]:
https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/log/?h=kvm-arm64/fixes-4.15

Signature · 1 line
Jazz is not dead. It just smells funny...