irqdomain: Let irq_domain_mapping display hierarchical domains
Hello Marc Zyngier,
This is a semi-automatic email about new static checker warnings.
The patch fe17a42e704a: "irqdomain: Let irq_domain_mapping display hierarchical domains" from May 12, 2017, leads to the following Smatch complaint:
kernel/irq/irqdomain.c:772 virq_debug_show_one()
warn: variable dereferenced before check 'data' (see line 758)
kernel/irq/irqdomain.c
757 while (domain) {
758 unsigned int irq = data->irq;
^^^^^^^^^Dereference.
759 unsigned long hwirq = data->hwirq;
760 struct irq_chip *chip;
761 bool direct;
762
763 if (data = &desc->irq_data)
764 seq_printf(m, "%5d ", irq);
765 else
766 seq_printf(m, "%5d+ ", irq);
767 seq_printf(m, "0x%05lx ", hwirq);
768
769 chip = irq_data_get_irq_chip(data);
770 seq_printf(m, "%-15s ", (chip && chip->name) ? chip->name : "none");
771
772 seq_printf(m, data ? "0x%p " : " %p ",
^^^^
Too late to check.
773 irq_data_get_irq_chip_data(data)); 774
regards,
dan carpenter
On Tue, 13 Jun 2017 22:32:52 +0300
Dan Carpenter <[email protected]> wrote:
Hi Dan,
Quoted 32 lines
Hello Marc Zyngier,
This is a semi-automatic email about new static checker warnings.
The patch
fe17a42e704a: "irqdomain: Letirq_domain_mappingdisplay hierarchical domains" from May 12, 2017, leads to the following Smatch complaint:
kernel/irq/irqdomain.c:772virq_debug_show_one()
warn: variable dereferenced before check 'data' (see line 758)
kernel/irq/irqdomain.c757 while (domain) { 758 unsigned int irq = data->irq; ^^^^^^^^^Dereference.
759 unsigned long hwirq = data->hwirq; 760 struct irq_chip *chip; 761 bool direct; 762 763 if (data = &desc->irq_data) 764 seq_printf(m, "%5d ", irq); 765 else 766 seq_printf(m, "%5d+ ", irq); 767 seq_printf(m, "0x%05lx ", hwirq); 768 769 chip = irq_data_get_irq_chip(data); 770 seq_printf(m, "%-15s ", (chip && chip->name) ? chip->name : "none"); 771 772 seq_printf(m, data ? "0x%p " : " %p ", ^^^^
Quoted 1 line
Too late to check.
This check is utter crap, and I should have nuked it when reworking that code. We're guaranteed that if "data" becomes NULL at the end of that loop, so will "domain". So the check is a leftover of... something.
I'll fix it in a subsequent patch, thanks a lot for the report.
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.