lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200903122159.GE8299@kadam>
Date:   Thu, 3 Sep 2020 15:21:59 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Lokesh Vutla <lokeshvutla@...com>
Cc:     lkp@...el.com, Dan Carpenter <error27@...il.com>,
        kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Marc Zyngier <maz@...nel.org>
Subject: drivers/irqchip/irq-ti-sci-intr.c:148 ti_sci_intr_alloc_parent_irq()
 warn: impossible condition '(p_hwirq < 0) => (0-u16max < 0)'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   fc3abb53250a90ba2150eebd182137c136f4d25a
commit: a5b659bd4bc7518a8e45fda5256c5e5e8d3b7c49 irqchip/ti-sci-intr: Add support for INTR being a parent to INTR
config: arm64-randconfig-m031-20200902 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>

smatch warnings:
drivers/irqchip/irq-ti-sci-intr.c:148 ti_sci_intr_alloc_parent_irq() warn: impossible condition '(p_hwirq < 0) => (0-u16max < 0)'

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a5b659bd4bc7518a8e45fda5256c5e5e8d3b7c49
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout a5b659bd4bc7518a8e45fda5256c5e5e8d3b7c49
vim +148 drivers/irqchip/irq-ti-sci-intr.c

a5b659bd4bc751 Lokesh Vutla 2020-08-06  134  static int ti_sci_intr_alloc_parent_irq(struct irq_domain *domain,
cd844b0715ceda Lokesh Vutla 2019-04-30  135  					unsigned int virq, u32 hwirq)
cd844b0715ceda Lokesh Vutla 2019-04-30  136  {
cd844b0715ceda Lokesh Vutla 2019-04-30  137  	struct ti_sci_intr_irq_domain *intr = domain->host_data;
a5b659bd4bc751 Lokesh Vutla 2020-08-06  138  	struct device_node *parent_node;
cd844b0715ceda Lokesh Vutla 2019-04-30  139  	struct irq_fwspec fwspec;
a5b659bd4bc751 Lokesh Vutla 2020-08-06  140  	u16 out_irq, p_hwirq;
                                                ^^^          ^^^^^^^

a5b659bd4bc751 Lokesh Vutla 2020-08-06  141  	int err = 0;
cd844b0715ceda Lokesh Vutla 2019-04-30  142  
a5b659bd4bc751 Lokesh Vutla 2020-08-06  143  	out_irq = ti_sci_get_free_resource(intr->out_irqs);
a5b659bd4bc751 Lokesh Vutla 2020-08-06  144  	if (out_irq == TI_SCI_RESOURCE_NULL)
cd844b0715ceda Lokesh Vutla 2019-04-30  145  		return -EINVAL;
cd844b0715ceda Lokesh Vutla 2019-04-30  146  
a5b659bd4bc751 Lokesh Vutla 2020-08-06  147  	p_hwirq = ti_sci_intr_xlate_irq(intr, out_irq);
a5b659bd4bc751 Lokesh Vutla 2020-08-06 @148  	if (p_hwirq < 0)
                                                    ^^^^^^^^^^^
Impossible

a5b659bd4bc751 Lokesh Vutla 2020-08-06  149  		goto err_irqs;
a5b659bd4bc751 Lokesh Vutla 2020-08-06  150  
a5b659bd4bc751 Lokesh Vutla 2020-08-06  151  	parent_node = of_irq_find_parent(dev_of_node(intr->dev));
a5b659bd4bc751 Lokesh Vutla 2020-08-06  152  	fwspec.fwnode = of_node_to_fwnode(parent_node);
a5b659bd4bc751 Lokesh Vutla 2020-08-06  153  
a5b659bd4bc751 Lokesh Vutla 2020-08-06  154  	if (of_device_is_compatible(parent_node, "arm,gic-v3")) {
a5b659bd4bc751 Lokesh Vutla 2020-08-06  155  		/* Parent is GIC */
cd844b0715ceda Lokesh Vutla 2019-04-30  156  		fwspec.param_count = 3;
cd844b0715ceda Lokesh Vutla 2019-04-30  157  		fwspec.param[0] = 0;	/* SPI */
a5b659bd4bc751 Lokesh Vutla 2020-08-06  158  		fwspec.param[1] = p_hwirq - 32; /* SPI offset */
cd844b0715ceda Lokesh Vutla 2019-04-30  159  		fwspec.param[2] = intr->type;
a5b659bd4bc751 Lokesh Vutla 2020-08-06  160  	} else {
a5b659bd4bc751 Lokesh Vutla 2020-08-06  161  		/* Parent is Interrupt Router */
a5b659bd4bc751 Lokesh Vutla 2020-08-06  162  		fwspec.param_count = 1;
a5b659bd4bc751 Lokesh Vutla 2020-08-06  163  		fwspec.param[0] = p_hwirq;
a5b659bd4bc751 Lokesh Vutla 2020-08-06  164  	}
cd844b0715ceda Lokesh Vutla 2019-04-30  165  
cd844b0715ceda Lokesh Vutla 2019-04-30  166  	err = irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec);
cd844b0715ceda Lokesh Vutla 2019-04-30  167  	if (err)
cd844b0715ceda Lokesh Vutla 2019-04-30  168  		goto err_irqs;
cd844b0715ceda Lokesh Vutla 2019-04-30  169  
a5b659bd4bc751 Lokesh Vutla 2020-08-06  170  	err = intr->sci->ops.rm_irq_ops.set_irq(intr->sci,
a5b659bd4bc751 Lokesh Vutla 2020-08-06  171  						intr->ti_sci_id, hwirq,
a5b659bd4bc751 Lokesh Vutla 2020-08-06  172  						intr->ti_sci_id, out_irq);
cd844b0715ceda Lokesh Vutla 2019-04-30  173  	if (err)
cd844b0715ceda Lokesh Vutla 2019-04-30  174  		goto err_msg;
cd844b0715ceda Lokesh Vutla 2019-04-30  175  
a5b659bd4bc751 Lokesh Vutla 2020-08-06  176  	return p_hwirq;
cd844b0715ceda Lokesh Vutla 2019-04-30  177  
cd844b0715ceda Lokesh Vutla 2019-04-30  178  err_msg:
cd844b0715ceda Lokesh Vutla 2019-04-30  179  	irq_domain_free_irqs_parent(domain, virq, 1);
cd844b0715ceda Lokesh Vutla 2019-04-30  180  err_irqs:
a5b659bd4bc751 Lokesh Vutla 2020-08-06  181  	ti_sci_release_resource(intr->out_irqs, out_irq);
cd844b0715ceda Lokesh Vutla 2019-04-30  182  	return err;
cd844b0715ceda Lokesh Vutla 2019-04-30  183  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (37827 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ