All of lore.kernel.org
 help / color / mirror / Atom feed
* [kbuild] drivers/irqchip/irq-gic-v3-mbi.c:306 mbi_init() warn: impossible condition '(mbi_phys_base == (-1)) => (0-u32max == u64max)'
@ 2020-09-08 17:49 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-09-08 17:49 UTC (permalink / raw)
  To: kbuild, Peng Fan; +Cc: lkp, kbuild-all, linux-kernel, Shawn Guo

[-- Attachment #1: Type: text/plain, Size: 4431 bytes --]

Hi Peng,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git  master
head:   f4d51dffc6c01a9e94650d95ce0104964f8ae822
commit: d82bcef5157de1368c08244a846ab968b3e5cb7e soc: imx: select ARM_GIC_V3 for i.MX8M
config: arm-randconfig-m031-20200908 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0

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

smatch warnings:
drivers/irqchip/irq-gic-v3-mbi.c:306 mbi_init() warn: impossible condition '(mbi_phys_base == (-1)) => (0-u32max == u64max)'

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d82bcef5157de1368c08244a846ab968b3e5cb7e 
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
git fetch --no-tags linus master
git checkout d82bcef5157de1368c08244a846ab968b3e5cb7e
vim +306 drivers/irqchip/irq-gic-v3-mbi.c

505287525c24d5 Marc Zyngier 2018-05-08  263  int __init mbi_init(struct fwnode_handle *fwnode, struct irq_domain *parent)
505287525c24d5 Marc Zyngier 2018-05-08  264  {
505287525c24d5 Marc Zyngier 2018-05-08  265  	struct device_node *np;
505287525c24d5 Marc Zyngier 2018-05-08  266  	const __be32 *reg;
505287525c24d5 Marc Zyngier 2018-05-08  267  	int ret, n;
505287525c24d5 Marc Zyngier 2018-05-08  268  
505287525c24d5 Marc Zyngier 2018-05-08  269  	np = to_of_node(fwnode);
505287525c24d5 Marc Zyngier 2018-05-08  270  
505287525c24d5 Marc Zyngier 2018-05-08  271  	if (!of_property_read_bool(np, "msi-controller"))
505287525c24d5 Marc Zyngier 2018-05-08  272  		return 0;
505287525c24d5 Marc Zyngier 2018-05-08  273  
505287525c24d5 Marc Zyngier 2018-05-08  274  	n = of_property_count_elems_of_size(np, "mbi-ranges", sizeof(u32));
505287525c24d5 Marc Zyngier 2018-05-08  275  	if (n <= 0 || n % 2)
505287525c24d5 Marc Zyngier 2018-05-08  276  		return -EINVAL;
505287525c24d5 Marc Zyngier 2018-05-08  277  
505287525c24d5 Marc Zyngier 2018-05-08  278  	mbi_range_nr = n / 2;
505287525c24d5 Marc Zyngier 2018-05-08  279  	mbi_ranges = kcalloc(mbi_range_nr, sizeof(*mbi_ranges), GFP_KERNEL);
505287525c24d5 Marc Zyngier 2018-05-08  280  	if (!mbi_ranges)
505287525c24d5 Marc Zyngier 2018-05-08  281  		return -ENOMEM;
505287525c24d5 Marc Zyngier 2018-05-08  282  
505287525c24d5 Marc Zyngier 2018-05-08  283  	for (n = 0; n < mbi_range_nr; n++) {
505287525c24d5 Marc Zyngier 2018-05-08  284  		ret = of_property_read_u32_index(np, "mbi-ranges", n * 2,
505287525c24d5 Marc Zyngier 2018-05-08  285  						 &mbi_ranges[n].spi_start);
505287525c24d5 Marc Zyngier 2018-05-08  286  		if (ret)
505287525c24d5 Marc Zyngier 2018-05-08  287  			goto err_free_mbi;
505287525c24d5 Marc Zyngier 2018-05-08  288  		ret = of_property_read_u32_index(np, "mbi-ranges", n * 2 + 1,
505287525c24d5 Marc Zyngier 2018-05-08  289  						 &mbi_ranges[n].nr_spis);
505287525c24d5 Marc Zyngier 2018-05-08  290  		if (ret)
505287525c24d5 Marc Zyngier 2018-05-08  291  			goto err_free_mbi;
505287525c24d5 Marc Zyngier 2018-05-08  292  
505287525c24d5 Marc Zyngier 2018-05-08  293  		mbi_ranges[n].bm = kcalloc(BITS_TO_LONGS(mbi_ranges[n].nr_spis),
505287525c24d5 Marc Zyngier 2018-05-08  294  					   sizeof(long), GFP_KERNEL);
505287525c24d5 Marc Zyngier 2018-05-08  295  		if (!mbi_ranges[n].bm) {
505287525c24d5 Marc Zyngier 2018-05-08  296  			ret = -ENOMEM;
505287525c24d5 Marc Zyngier 2018-05-08  297  			goto err_free_mbi;
505287525c24d5 Marc Zyngier 2018-05-08  298  		}
505287525c24d5 Marc Zyngier 2018-05-08  299  		pr_info("MBI range [%d:%d]\n", mbi_ranges[n].spi_start,
505287525c24d5 Marc Zyngier 2018-05-08  300  			mbi_ranges[n].spi_start + mbi_ranges[n].nr_spis - 1);
505287525c24d5 Marc Zyngier 2018-05-08  301  	}
505287525c24d5 Marc Zyngier 2018-05-08  302  
505287525c24d5 Marc Zyngier 2018-05-08  303  	reg = of_get_property(np, "mbi-alias", NULL);
505287525c24d5 Marc Zyngier 2018-05-08  304  	if (reg) {
505287525c24d5 Marc Zyngier 2018-05-08  305  		mbi_phys_base = of_translate_address(np, reg);
505287525c24d5 Marc Zyngier 2018-05-08 @306  		if (mbi_phys_base == OF_BAD_ADDR) {
                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Impossible condition.

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 42555 bytes --]

[-- Attachment #3: Type: text/plain, Size: 149 bytes --]

_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* drivers/irqchip/irq-gic-v3-mbi.c:306 mbi_init() warn: impossible condition '(mbi_phys_base == (-1)) => (0-u32max == u64max)'
@ 2020-09-08 17:49 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-09-08 17:49 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 4662 bytes --]

Hi Peng,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git  master
head:   f4d51dffc6c01a9e94650d95ce0104964f8ae822
commit: d82bcef5157de1368c08244a846ab968b3e5cb7e soc: imx: select ARM_GIC_V3 for i.MX8M
config: arm-randconfig-m031-20200908 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0

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

smatch warnings:
drivers/irqchip/irq-gic-v3-mbi.c:306 mbi_init() warn: impossible condition '(mbi_phys_base == (-1)) => (0-u32max == u64max)'

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d82bcef5157de1368c08244a846ab968b3e5cb7e 
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
git fetch --no-tags linus master
git checkout d82bcef5157de1368c08244a846ab968b3e5cb7e
vim +306 drivers/irqchip/irq-gic-v3-mbi.c

505287525c24d5 Marc Zyngier 2018-05-08  263  int __init mbi_init(struct fwnode_handle *fwnode, struct irq_domain *parent)
505287525c24d5 Marc Zyngier 2018-05-08  264  {
505287525c24d5 Marc Zyngier 2018-05-08  265  	struct device_node *np;
505287525c24d5 Marc Zyngier 2018-05-08  266  	const __be32 *reg;
505287525c24d5 Marc Zyngier 2018-05-08  267  	int ret, n;
505287525c24d5 Marc Zyngier 2018-05-08  268  
505287525c24d5 Marc Zyngier 2018-05-08  269  	np = to_of_node(fwnode);
505287525c24d5 Marc Zyngier 2018-05-08  270  
505287525c24d5 Marc Zyngier 2018-05-08  271  	if (!of_property_read_bool(np, "msi-controller"))
505287525c24d5 Marc Zyngier 2018-05-08  272  		return 0;
505287525c24d5 Marc Zyngier 2018-05-08  273  
505287525c24d5 Marc Zyngier 2018-05-08  274  	n = of_property_count_elems_of_size(np, "mbi-ranges", sizeof(u32));
505287525c24d5 Marc Zyngier 2018-05-08  275  	if (n <= 0 || n % 2)
505287525c24d5 Marc Zyngier 2018-05-08  276  		return -EINVAL;
505287525c24d5 Marc Zyngier 2018-05-08  277  
505287525c24d5 Marc Zyngier 2018-05-08  278  	mbi_range_nr = n / 2;
505287525c24d5 Marc Zyngier 2018-05-08  279  	mbi_ranges = kcalloc(mbi_range_nr, sizeof(*mbi_ranges), GFP_KERNEL);
505287525c24d5 Marc Zyngier 2018-05-08  280  	if (!mbi_ranges)
505287525c24d5 Marc Zyngier 2018-05-08  281  		return -ENOMEM;
505287525c24d5 Marc Zyngier 2018-05-08  282  
505287525c24d5 Marc Zyngier 2018-05-08  283  	for (n = 0; n < mbi_range_nr; n++) {
505287525c24d5 Marc Zyngier 2018-05-08  284  		ret = of_property_read_u32_index(np, "mbi-ranges", n * 2,
505287525c24d5 Marc Zyngier 2018-05-08  285  						 &mbi_ranges[n].spi_start);
505287525c24d5 Marc Zyngier 2018-05-08  286  		if (ret)
505287525c24d5 Marc Zyngier 2018-05-08  287  			goto err_free_mbi;
505287525c24d5 Marc Zyngier 2018-05-08  288  		ret = of_property_read_u32_index(np, "mbi-ranges", n * 2 + 1,
505287525c24d5 Marc Zyngier 2018-05-08  289  						 &mbi_ranges[n].nr_spis);
505287525c24d5 Marc Zyngier 2018-05-08  290  		if (ret)
505287525c24d5 Marc Zyngier 2018-05-08  291  			goto err_free_mbi;
505287525c24d5 Marc Zyngier 2018-05-08  292  
505287525c24d5 Marc Zyngier 2018-05-08  293  		mbi_ranges[n].bm = kcalloc(BITS_TO_LONGS(mbi_ranges[n].nr_spis),
505287525c24d5 Marc Zyngier 2018-05-08  294  					   sizeof(long), GFP_KERNEL);
505287525c24d5 Marc Zyngier 2018-05-08  295  		if (!mbi_ranges[n].bm) {
505287525c24d5 Marc Zyngier 2018-05-08  296  			ret = -ENOMEM;
505287525c24d5 Marc Zyngier 2018-05-08  297  			goto err_free_mbi;
505287525c24d5 Marc Zyngier 2018-05-08  298  		}
505287525c24d5 Marc Zyngier 2018-05-08  299  		pr_info("MBI range [%d:%d]\n", mbi_ranges[n].spi_start,
505287525c24d5 Marc Zyngier 2018-05-08  300  			mbi_ranges[n].spi_start + mbi_ranges[n].nr_spis - 1);
505287525c24d5 Marc Zyngier 2018-05-08  301  	}
505287525c24d5 Marc Zyngier 2018-05-08  302  
505287525c24d5 Marc Zyngier 2018-05-08  303  	reg = of_get_property(np, "mbi-alias", NULL);
505287525c24d5 Marc Zyngier 2018-05-08  304  	if (reg) {
505287525c24d5 Marc Zyngier 2018-05-08  305  		mbi_phys_base = of_translate_address(np, reg);
505287525c24d5 Marc Zyngier 2018-05-08 @306  		if (mbi_phys_base == OF_BAD_ADDR) {
                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Impossible condition.

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

_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 42555 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [kbuild] drivers/irqchip/irq-gic-v3-mbi.c:306 mbi_init() warn: impossible condition '(mbi_phys_base == (-1)) => (0-u32max == u64max)'
@ 2020-09-08 17:49 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-09-08 17:49 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4662 bytes --]

Hi Peng,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git  master
head:   f4d51dffc6c01a9e94650d95ce0104964f8ae822
commit: d82bcef5157de1368c08244a846ab968b3e5cb7e soc: imx: select ARM_GIC_V3 for i.MX8M
config: arm-randconfig-m031-20200908 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0

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

smatch warnings:
drivers/irqchip/irq-gic-v3-mbi.c:306 mbi_init() warn: impossible condition '(mbi_phys_base == (-1)) => (0-u32max == u64max)'

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d82bcef5157de1368c08244a846ab968b3e5cb7e 
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
git fetch --no-tags linus master
git checkout d82bcef5157de1368c08244a846ab968b3e5cb7e
vim +306 drivers/irqchip/irq-gic-v3-mbi.c

505287525c24d5 Marc Zyngier 2018-05-08  263  int __init mbi_init(struct fwnode_handle *fwnode, struct irq_domain *parent)
505287525c24d5 Marc Zyngier 2018-05-08  264  {
505287525c24d5 Marc Zyngier 2018-05-08  265  	struct device_node *np;
505287525c24d5 Marc Zyngier 2018-05-08  266  	const __be32 *reg;
505287525c24d5 Marc Zyngier 2018-05-08  267  	int ret, n;
505287525c24d5 Marc Zyngier 2018-05-08  268  
505287525c24d5 Marc Zyngier 2018-05-08  269  	np = to_of_node(fwnode);
505287525c24d5 Marc Zyngier 2018-05-08  270  
505287525c24d5 Marc Zyngier 2018-05-08  271  	if (!of_property_read_bool(np, "msi-controller"))
505287525c24d5 Marc Zyngier 2018-05-08  272  		return 0;
505287525c24d5 Marc Zyngier 2018-05-08  273  
505287525c24d5 Marc Zyngier 2018-05-08  274  	n = of_property_count_elems_of_size(np, "mbi-ranges", sizeof(u32));
505287525c24d5 Marc Zyngier 2018-05-08  275  	if (n <= 0 || n % 2)
505287525c24d5 Marc Zyngier 2018-05-08  276  		return -EINVAL;
505287525c24d5 Marc Zyngier 2018-05-08  277  
505287525c24d5 Marc Zyngier 2018-05-08  278  	mbi_range_nr = n / 2;
505287525c24d5 Marc Zyngier 2018-05-08  279  	mbi_ranges = kcalloc(mbi_range_nr, sizeof(*mbi_ranges), GFP_KERNEL);
505287525c24d5 Marc Zyngier 2018-05-08  280  	if (!mbi_ranges)
505287525c24d5 Marc Zyngier 2018-05-08  281  		return -ENOMEM;
505287525c24d5 Marc Zyngier 2018-05-08  282  
505287525c24d5 Marc Zyngier 2018-05-08  283  	for (n = 0; n < mbi_range_nr; n++) {
505287525c24d5 Marc Zyngier 2018-05-08  284  		ret = of_property_read_u32_index(np, "mbi-ranges", n * 2,
505287525c24d5 Marc Zyngier 2018-05-08  285  						 &mbi_ranges[n].spi_start);
505287525c24d5 Marc Zyngier 2018-05-08  286  		if (ret)
505287525c24d5 Marc Zyngier 2018-05-08  287  			goto err_free_mbi;
505287525c24d5 Marc Zyngier 2018-05-08  288  		ret = of_property_read_u32_index(np, "mbi-ranges", n * 2 + 1,
505287525c24d5 Marc Zyngier 2018-05-08  289  						 &mbi_ranges[n].nr_spis);
505287525c24d5 Marc Zyngier 2018-05-08  290  		if (ret)
505287525c24d5 Marc Zyngier 2018-05-08  291  			goto err_free_mbi;
505287525c24d5 Marc Zyngier 2018-05-08  292  
505287525c24d5 Marc Zyngier 2018-05-08  293  		mbi_ranges[n].bm = kcalloc(BITS_TO_LONGS(mbi_ranges[n].nr_spis),
505287525c24d5 Marc Zyngier 2018-05-08  294  					   sizeof(long), GFP_KERNEL);
505287525c24d5 Marc Zyngier 2018-05-08  295  		if (!mbi_ranges[n].bm) {
505287525c24d5 Marc Zyngier 2018-05-08  296  			ret = -ENOMEM;
505287525c24d5 Marc Zyngier 2018-05-08  297  			goto err_free_mbi;
505287525c24d5 Marc Zyngier 2018-05-08  298  		}
505287525c24d5 Marc Zyngier 2018-05-08  299  		pr_info("MBI range [%d:%d]\n", mbi_ranges[n].spi_start,
505287525c24d5 Marc Zyngier 2018-05-08  300  			mbi_ranges[n].spi_start + mbi_ranges[n].nr_spis - 1);
505287525c24d5 Marc Zyngier 2018-05-08  301  	}
505287525c24d5 Marc Zyngier 2018-05-08  302  
505287525c24d5 Marc Zyngier 2018-05-08  303  	reg = of_get_property(np, "mbi-alias", NULL);
505287525c24d5 Marc Zyngier 2018-05-08  304  	if (reg) {
505287525c24d5 Marc Zyngier 2018-05-08  305  		mbi_phys_base = of_translate_address(np, reg);
505287525c24d5 Marc Zyngier 2018-05-08 @306  		if (mbi_phys_base == OF_BAD_ADDR) {
                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Impossible condition.

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

_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 42555 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-08 17:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-08 17:49 [kbuild] drivers/irqchip/irq-gic-v3-mbi.c:306 mbi_init() warn: impossible condition '(mbi_phys_base == (-1)) => (0-u32max == u64max)' Dan Carpenter
2020-09-08 17:49 ` Dan Carpenter
2020-09-08 17:49 ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.