Coverity warns that pirq_dpci unconditionally dereferences a NULL pointer.
This warning appears to be triggered by pirq_dpci() which is a hidden ternary
expression. In reality, it appears that both callers pass a non-NULL pirq
parameter, so the code is ok in practice.
Rearange the logic to fail-safe, which should quiesce Coverity.
Clean up bool_t => bool and trailing whitespace for hvm_domain_use_pirq()
while auditing this area.
No (intended) functional change.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
spin_unlock_irqrestore(&desc->lock, flags);
}
-bool_t hvm_domain_use_pirq(const struct domain *d, const struct pirq *pirq)
+bool hvm_domain_use_pirq(const struct domain *d, const struct pirq *pirq)
{
- return is_hvm_domain(d) && pirq &&
- pirq->arch.hvm.emuirq != IRQ_UNBOUND;
+ return is_hvm_domain(d) && pirq && pirq->arch.hvm.emuirq != IRQ_UNBOUND;
}
static int allocate_pirq(struct domain *d, int index, int pirq, int irq,
static void hvm_pirq_eoi(struct pirq *pirq,
const union vioapic_redir_entry *ent)
{
- struct hvm_pirq_dpci *pirq_dpci = pirq_dpci(pirq);
+ struct hvm_pirq_dpci *pirq_dpci;
+
+ if ( !pirq )
+ {
+ ASSERT_UNREACHABLE();
+ return;
+ }
+
+ pirq_dpci = pirq_dpci(pirq);
/*
* No need to get vector lock for timer
void free_domain_pirqs(struct domain *d);
int map_domain_emuirq_pirq(struct domain *d, int pirq, int irq);
int unmap_domain_pirq_emuirq(struct domain *d, int pirq);
-bool_t hvm_domain_use_pirq(const struct domain *, const struct pirq *);
+bool hvm_domain_use_pirq(const struct domain *, const struct pirq *);
/* Reset irq affinities to match the given CPU mask. */
void fixup_irqs(const cpumask_t *mask, bool_t verbose);