All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/irqchip/irq-stm32-exti.c:719 stm32_exti_h_domain_alloc() warn: variable dereferenced before check 'host_data->drv_data' (see line 707)
@ 2022-08-15  6:51 ` Dan Carpenter
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2022-08-13  9:42 UTC (permalink / raw)
  To: kbuild

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

BCC: lkp(a)intel.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Antonio Borneo <antonio.borneo@foss.st.com>
CC: Marc Zyngier <maz@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   69dac8e431af26173ca0a1ebc87054e01c585bcc
commit: c297493336b7bc0c12ced484a9e61d04ec2d9403 irqchip/stm32-exti: Simplify irq description table
date:   5 weeks ago
:::::: branch date: 8 hours ago
:::::: commit date: 5 weeks ago
config: arm-randconfig-m041-20220812 (https://download.01.org/0day-ci/archive/20220813/202208131739.gJvcs9ls-lkp(a)intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0

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

smatch warnings:
drivers/irqchip/irq-stm32-exti.c:719 stm32_exti_h_domain_alloc() warn: variable dereferenced before check 'host_data->drv_data' (see line 707)

vim +719 drivers/irqchip/irq-stm32-exti.c

9d6a5fe1757cbbd9 Alexandre Torgue 2020-07-17  691  
927abfc4461e7fd7 Ludovic Barre    2018-04-26  692  static int stm32_exti_h_domain_alloc(struct irq_domain *dm,
927abfc4461e7fd7 Ludovic Barre    2018-04-26  693  				     unsigned int virq,
927abfc4461e7fd7 Ludovic Barre    2018-04-26  694  				     unsigned int nr_irqs, void *data)
927abfc4461e7fd7 Ludovic Barre    2018-04-26  695  {
927abfc4461e7fd7 Ludovic Barre    2018-04-26  696  	struct stm32_exti_host_data *host_data = dm->host_data;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  697  	struct stm32_exti_chip_data *chip_data;
c297493336b7bc0c Antonio Borneo   2022-06-06  698  	u8 desc_irq;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  699  	struct irq_fwspec *fwspec = data;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  700  	struct irq_fwspec p_fwspec;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  701  	irq_hw_number_t hwirq;
9d6a5fe1757cbbd9 Alexandre Torgue 2020-07-17  702  	int bank;
ce4ef8f9f2abcf10 Antonio Borneo   2022-06-06  703  	u32 event_trg;
ce4ef8f9f2abcf10 Antonio Borneo   2022-06-06  704  	struct irq_chip *chip;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  705  
927abfc4461e7fd7 Ludovic Barre    2018-04-26  706  	hwirq = fwspec->param[0];
c16ae609214e8356 Antonio Borneo   2022-06-06 @707  	if (hwirq >= host_data->drv_data->bank_nr * IRQS_PER_BANK)
c16ae609214e8356 Antonio Borneo   2022-06-06  708  		return -EINVAL;
c16ae609214e8356 Antonio Borneo   2022-06-06  709  
927abfc4461e7fd7 Ludovic Barre    2018-04-26  710  	bank  = hwirq / IRQS_PER_BANK;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  711  	chip_data = &host_data->chips_data[bank];
927abfc4461e7fd7 Ludovic Barre    2018-04-26  712  
ce4ef8f9f2abcf10 Antonio Borneo   2022-06-06  713  	event_trg = readl_relaxed(host_data->base + chip_data->reg_bank->trg_ofst);
ce4ef8f9f2abcf10 Antonio Borneo   2022-06-06  714  	chip = (event_trg & BIT(hwirq % IRQS_PER_BANK)) ?
ce4ef8f9f2abcf10 Antonio Borneo   2022-06-06  715  	       &stm32_exti_h_chip : &stm32_exti_h_chip_direct;
ce4ef8f9f2abcf10 Antonio Borneo   2022-06-06  716  
ce4ef8f9f2abcf10 Antonio Borneo   2022-06-06  717  	irq_domain_set_hwirq_and_chip(dm, virq, hwirq, chip, chip_data);
c297493336b7bc0c Antonio Borneo   2022-06-06  718  
c297493336b7bc0c Antonio Borneo   2022-06-06 @719  	if (!host_data->drv_data || !host_data->drv_data->desc_irqs)
c297493336b7bc0c Antonio Borneo   2022-06-06  720  		return -EINVAL;
c297493336b7bc0c Antonio Borneo   2022-06-06  721  
c297493336b7bc0c Antonio Borneo   2022-06-06  722  	desc_irq = host_data->drv_data->desc_irqs[hwirq];
c297493336b7bc0c Antonio Borneo   2022-06-06  723  	if (desc_irq != EXTI_INVALID_IRQ) {
927abfc4461e7fd7 Ludovic Barre    2018-04-26  724  		p_fwspec.fwnode = dm->parent->fwnode;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  725  		p_fwspec.param_count = 3;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  726  		p_fwspec.param[0] = GIC_SPI;
c297493336b7bc0c Antonio Borneo   2022-06-06  727  		p_fwspec.param[1] = desc_irq;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  728  		p_fwspec.param[2] = IRQ_TYPE_LEVEL_HIGH;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  729  
927abfc4461e7fd7 Ludovic Barre    2018-04-26  730  		return irq_domain_alloc_irqs_parent(dm, virq, 1, &p_fwspec);
927abfc4461e7fd7 Ludovic Barre    2018-04-26  731  	}
927abfc4461e7fd7 Ludovic Barre    2018-04-26  732  
927abfc4461e7fd7 Ludovic Barre    2018-04-26  733  	return 0;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  734  }
927abfc4461e7fd7 Ludovic Barre    2018-04-26  735  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* drivers/irqchip/irq-stm32-exti.c:719 stm32_exti_h_domain_alloc() warn: variable dereferenced before check 'host_data->drv_data' (see line 707)
@ 2022-08-15  6:51 ` Dan Carpenter
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2022-08-15  6:51 UTC (permalink / raw)
  To: kbuild, Antonio Borneo; +Cc: lkp, kbuild-all, linux-kernel, Marc Zyngier

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   69dac8e431af26173ca0a1ebc87054e01c585bcc
commit: c297493336b7bc0c12ced484a9e61d04ec2d9403 irqchip/stm32-exti: Simplify irq description table
config: arm-randconfig-m041-20220812 (https://download.01.org/0day-ci/archive/20220813/202208131739.gJvcs9ls-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0

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

smatch warnings:
drivers/irqchip/irq-stm32-exti.c:719 stm32_exti_h_domain_alloc() warn: variable dereferenced before check 'host_data->drv_data' (see line 707)

vim +719 drivers/irqchip/irq-stm32-exti.c

927abfc4461e7fd7 Ludovic Barre    2018-04-26  692  static int stm32_exti_h_domain_alloc(struct irq_domain *dm,
927abfc4461e7fd7 Ludovic Barre    2018-04-26  693  				     unsigned int virq,
927abfc4461e7fd7 Ludovic Barre    2018-04-26  694  				     unsigned int nr_irqs, void *data)
927abfc4461e7fd7 Ludovic Barre    2018-04-26  695  {
927abfc4461e7fd7 Ludovic Barre    2018-04-26  696  	struct stm32_exti_host_data *host_data = dm->host_data;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  697  	struct stm32_exti_chip_data *chip_data;
c297493336b7bc0c Antonio Borneo   2022-06-06  698  	u8 desc_irq;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  699  	struct irq_fwspec *fwspec = data;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  700  	struct irq_fwspec p_fwspec;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  701  	irq_hw_number_t hwirq;
9d6a5fe1757cbbd9 Alexandre Torgue 2020-07-17  702  	int bank;
ce4ef8f9f2abcf10 Antonio Borneo   2022-06-06  703  	u32 event_trg;
ce4ef8f9f2abcf10 Antonio Borneo   2022-06-06  704  	struct irq_chip *chip;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  705  
927abfc4461e7fd7 Ludovic Barre    2018-04-26  706  	hwirq = fwspec->param[0];
c16ae609214e8356 Antonio Borneo   2022-06-06 @707  	if (hwirq >= host_data->drv_data->bank_nr * IRQS_PER_BANK)
                                                                     ^^^^^^^^^^^^^^^^^^^^^
derefernce

c16ae609214e8356 Antonio Borneo   2022-06-06  708  		return -EINVAL;
c16ae609214e8356 Antonio Borneo   2022-06-06  709  
927abfc4461e7fd7 Ludovic Barre    2018-04-26  710  	bank  = hwirq / IRQS_PER_BANK;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  711  	chip_data = &host_data->chips_data[bank];
927abfc4461e7fd7 Ludovic Barre    2018-04-26  712  
ce4ef8f9f2abcf10 Antonio Borneo   2022-06-06  713  	event_trg = readl_relaxed(host_data->base + chip_data->reg_bank->trg_ofst);
ce4ef8f9f2abcf10 Antonio Borneo   2022-06-06  714  	chip = (event_trg & BIT(hwirq % IRQS_PER_BANK)) ?
ce4ef8f9f2abcf10 Antonio Borneo   2022-06-06  715  	       &stm32_exti_h_chip : &stm32_exti_h_chip_direct;
ce4ef8f9f2abcf10 Antonio Borneo   2022-06-06  716  
ce4ef8f9f2abcf10 Antonio Borneo   2022-06-06  717  	irq_domain_set_hwirq_and_chip(dm, virq, hwirq, chip, chip_data);
c297493336b7bc0c Antonio Borneo   2022-06-06  718  
c297493336b7bc0c Antonio Borneo   2022-06-06 @719  	if (!host_data->drv_data || !host_data->drv_data->desc_irqs)
                                                             ^^^^^^^^^^^^^^^^^^^
checked too late

c297493336b7bc0c Antonio Borneo   2022-06-06  720  		return -EINVAL;
c297493336b7bc0c Antonio Borneo   2022-06-06  721  
c297493336b7bc0c Antonio Borneo   2022-06-06  722  	desc_irq = host_data->drv_data->desc_irqs[hwirq];
c297493336b7bc0c Antonio Borneo   2022-06-06  723  	if (desc_irq != EXTI_INVALID_IRQ) {
927abfc4461e7fd7 Ludovic Barre    2018-04-26  724  		p_fwspec.fwnode = dm->parent->fwnode;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  725  		p_fwspec.param_count = 3;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  726  		p_fwspec.param[0] = GIC_SPI;
c297493336b7bc0c Antonio Borneo   2022-06-06  727  		p_fwspec.param[1] = desc_irq;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  728  		p_fwspec.param[2] = IRQ_TYPE_LEVEL_HIGH;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  729  
927abfc4461e7fd7 Ludovic Barre    2018-04-26  730  		return irq_domain_alloc_irqs_parent(dm, virq, 1, &p_fwspec);
927abfc4461e7fd7 Ludovic Barre    2018-04-26  731  	}
927abfc4461e7fd7 Ludovic Barre    2018-04-26  732  
927abfc4461e7fd7 Ludovic Barre    2018-04-26  733  	return 0;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  734  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


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

* drivers/irqchip/irq-stm32-exti.c:719 stm32_exti_h_domain_alloc() warn: variable dereferenced before check 'host_data->drv_data' (see line 707)
@ 2022-08-15  6:51 ` Dan Carpenter
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2022-08-15  6:51 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   69dac8e431af26173ca0a1ebc87054e01c585bcc
commit: c297493336b7bc0c12ced484a9e61d04ec2d9403 irqchip/stm32-exti: Simplify irq description table
config: arm-randconfig-m041-20220812 (https://download.01.org/0day-ci/archive/20220813/202208131739.gJvcs9ls-lkp(a)intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0

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

smatch warnings:
drivers/irqchip/irq-stm32-exti.c:719 stm32_exti_h_domain_alloc() warn: variable dereferenced before check 'host_data->drv_data' (see line 707)

vim +719 drivers/irqchip/irq-stm32-exti.c

927abfc4461e7fd7 Ludovic Barre    2018-04-26  692  static int stm32_exti_h_domain_alloc(struct irq_domain *dm,
927abfc4461e7fd7 Ludovic Barre    2018-04-26  693  				     unsigned int virq,
927abfc4461e7fd7 Ludovic Barre    2018-04-26  694  				     unsigned int nr_irqs, void *data)
927abfc4461e7fd7 Ludovic Barre    2018-04-26  695  {
927abfc4461e7fd7 Ludovic Barre    2018-04-26  696  	struct stm32_exti_host_data *host_data = dm->host_data;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  697  	struct stm32_exti_chip_data *chip_data;
c297493336b7bc0c Antonio Borneo   2022-06-06  698  	u8 desc_irq;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  699  	struct irq_fwspec *fwspec = data;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  700  	struct irq_fwspec p_fwspec;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  701  	irq_hw_number_t hwirq;
9d6a5fe1757cbbd9 Alexandre Torgue 2020-07-17  702  	int bank;
ce4ef8f9f2abcf10 Antonio Borneo   2022-06-06  703  	u32 event_trg;
ce4ef8f9f2abcf10 Antonio Borneo   2022-06-06  704  	struct irq_chip *chip;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  705  
927abfc4461e7fd7 Ludovic Barre    2018-04-26  706  	hwirq = fwspec->param[0];
c16ae609214e8356 Antonio Borneo   2022-06-06 @707  	if (hwirq >= host_data->drv_data->bank_nr * IRQS_PER_BANK)
                                                                     ^^^^^^^^^^^^^^^^^^^^^
derefernce

c16ae609214e8356 Antonio Borneo   2022-06-06  708  		return -EINVAL;
c16ae609214e8356 Antonio Borneo   2022-06-06  709  
927abfc4461e7fd7 Ludovic Barre    2018-04-26  710  	bank  = hwirq / IRQS_PER_BANK;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  711  	chip_data = &host_data->chips_data[bank];
927abfc4461e7fd7 Ludovic Barre    2018-04-26  712  
ce4ef8f9f2abcf10 Antonio Borneo   2022-06-06  713  	event_trg = readl_relaxed(host_data->base + chip_data->reg_bank->trg_ofst);
ce4ef8f9f2abcf10 Antonio Borneo   2022-06-06  714  	chip = (event_trg & BIT(hwirq % IRQS_PER_BANK)) ?
ce4ef8f9f2abcf10 Antonio Borneo   2022-06-06  715  	       &stm32_exti_h_chip : &stm32_exti_h_chip_direct;
ce4ef8f9f2abcf10 Antonio Borneo   2022-06-06  716  
ce4ef8f9f2abcf10 Antonio Borneo   2022-06-06  717  	irq_domain_set_hwirq_and_chip(dm, virq, hwirq, chip, chip_data);
c297493336b7bc0c Antonio Borneo   2022-06-06  718  
c297493336b7bc0c Antonio Borneo   2022-06-06 @719  	if (!host_data->drv_data || !host_data->drv_data->desc_irqs)
                                                             ^^^^^^^^^^^^^^^^^^^
checked too late

c297493336b7bc0c Antonio Borneo   2022-06-06  720  		return -EINVAL;
c297493336b7bc0c Antonio Borneo   2022-06-06  721  
c297493336b7bc0c Antonio Borneo   2022-06-06  722  	desc_irq = host_data->drv_data->desc_irqs[hwirq];
c297493336b7bc0c Antonio Borneo   2022-06-06  723  	if (desc_irq != EXTI_INVALID_IRQ) {
927abfc4461e7fd7 Ludovic Barre    2018-04-26  724  		p_fwspec.fwnode = dm->parent->fwnode;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  725  		p_fwspec.param_count = 3;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  726  		p_fwspec.param[0] = GIC_SPI;
c297493336b7bc0c Antonio Borneo   2022-06-06  727  		p_fwspec.param[1] = desc_irq;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  728  		p_fwspec.param[2] = IRQ_TYPE_LEVEL_HIGH;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  729  
927abfc4461e7fd7 Ludovic Barre    2018-04-26  730  		return irq_domain_alloc_irqs_parent(dm, virq, 1, &p_fwspec);
927abfc4461e7fd7 Ludovic Barre    2018-04-26  731  	}
927abfc4461e7fd7 Ludovic Barre    2018-04-26  732  
927abfc4461e7fd7 Ludovic Barre    2018-04-26  733  	return 0;
927abfc4461e7fd7 Ludovic Barre    2018-04-26  734  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* [PATCH] irqchip/stm32-exti: Remove check on always false condition
  2022-08-15  6:51 ` Dan Carpenter
@ 2022-08-17 12:57   ` Antonio Borneo
  -1 siblings, 0 replies; 7+ messages in thread
From: Antonio Borneo @ 2022-08-17 12:57 UTC (permalink / raw)
  To: Thomas Gleixner, Marc Zyngier, Maxime Coquelin, Alexandre Torgue,
	linux-kernel, linux-stm32, linux-arm-kernel
  Cc: Antonio Borneo, Dan Carpenter, kernel test robot

The field drv_data is assigned during driver's probe, where it's
already checked to be not NULL.

Remove the always false check '!host_data->drv_data'.

This fixes a warning "variable dereferenced before check" detected
by '0-DAY CI Kernel Test Service'.

Fixes: c297493336b7 ("irqchip/stm32-exti: Simplify irq description table")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/lkml/202208131739.gJvcs9ls-lkp@intel.com/
Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
---
 drivers/irqchip/irq-stm32-exti.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c
index a73763d475f0..6a3f7498ea8e 100644
--- a/drivers/irqchip/irq-stm32-exti.c
+++ b/drivers/irqchip/irq-stm32-exti.c
@@ -716,7 +716,7 @@ static int stm32_exti_h_domain_alloc(struct irq_domain *dm,
 
 	irq_domain_set_hwirq_and_chip(dm, virq, hwirq, chip, chip_data);
 
-	if (!host_data->drv_data || !host_data->drv_data->desc_irqs)
+	if (!host_data->drv_data->desc_irqs)
 		return -EINVAL;
 
 	desc_irq = host_data->drv_data->desc_irqs[hwirq];

base-commit: 568035b01cfb107af8d2e4bd2fb9aea22cf5b868
-- 
2.25.1


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

* [PATCH] irqchip/stm32-exti: Remove check on always false condition
@ 2022-08-17 12:57   ` Antonio Borneo
  0 siblings, 0 replies; 7+ messages in thread
From: Antonio Borneo @ 2022-08-17 12:57 UTC (permalink / raw)
  To: Thomas Gleixner, Marc Zyngier, Maxime Coquelin, Alexandre Torgue,
	linux-kernel, linux-stm32, linux-arm-kernel
  Cc: Antonio Borneo, Dan Carpenter, kernel test robot

The field drv_data is assigned during driver's probe, where it's
already checked to be not NULL.

Remove the always false check '!host_data->drv_data'.

This fixes a warning "variable dereferenced before check" detected
by '0-DAY CI Kernel Test Service'.

Fixes: c297493336b7 ("irqchip/stm32-exti: Simplify irq description table")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/lkml/202208131739.gJvcs9ls-lkp@intel.com/
Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
---
 drivers/irqchip/irq-stm32-exti.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c
index a73763d475f0..6a3f7498ea8e 100644
--- a/drivers/irqchip/irq-stm32-exti.c
+++ b/drivers/irqchip/irq-stm32-exti.c
@@ -716,7 +716,7 @@ static int stm32_exti_h_domain_alloc(struct irq_domain *dm,
 
 	irq_domain_set_hwirq_and_chip(dm, virq, hwirq, chip, chip_data);
 
-	if (!host_data->drv_data || !host_data->drv_data->desc_irqs)
+	if (!host_data->drv_data->desc_irqs)
 		return -EINVAL;
 
 	desc_irq = host_data->drv_data->desc_irqs[hwirq];

base-commit: 568035b01cfb107af8d2e4bd2fb9aea22cf5b868
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [irqchip: irq/irqchip-fixes] irqchip/stm32-exti: Remove check on always false condition
  2022-08-17 12:57   ` Antonio Borneo
  (?)
@ 2022-08-17 13:42   ` irqchip-bot for Antonio Borneo
  -1 siblings, 0 replies; 7+ messages in thread
From: irqchip-bot for Antonio Borneo @ 2022-08-17 13:42 UTC (permalink / raw)
  To: linux-kernel
  Cc: kernel test robot, Dan Carpenter, Antonio Borneo, Marc Zyngier, tglx

The following commit has been merged into the irq/irqchip-fixes branch of irqchip:

Commit-ID:     c3e88d91e40971337d4e7b5250e9e17d3e64238c
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/c3e88d91e40971337d4e7b5250e9e17d3e64238c
Author:        Antonio Borneo <antonio.borneo@foss.st.com>
AuthorDate:    Wed, 17 Aug 2022 14:57:58 +02:00
Committer:     Marc Zyngier <maz@kernel.org>
CommitterDate: Wed, 17 Aug 2022 14:19:48 +01:00

irqchip/stm32-exti: Remove check on always false condition

The field drv_data is assigned during driver's probe, where it's
already checked to be not NULL.

Remove the always false check '!host_data->drv_data'.

This fixes a warning "variable dereferenced before check" detected
by '0-DAY CI Kernel Test Service'.

Fixes: c297493336b7 ("irqchip/stm32-exti: Simplify irq description table")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/lkml/202208131739.gJvcs9ls-lkp@intel.com/
Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220817125758.5975-1-antonio.borneo@foss.st.com
---
 drivers/irqchip/irq-stm32-exti.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c
index a73763d..6a3f749 100644
--- a/drivers/irqchip/irq-stm32-exti.c
+++ b/drivers/irqchip/irq-stm32-exti.c
@@ -716,7 +716,7 @@ static int stm32_exti_h_domain_alloc(struct irq_domain *dm,
 
 	irq_domain_set_hwirq_and_chip(dm, virq, hwirq, chip, chip_data);
 
-	if (!host_data->drv_data || !host_data->drv_data->desc_irqs)
+	if (!host_data->drv_data->desc_irqs)
 		return -EINVAL;
 
 	desc_irq = host_data->drv_data->desc_irqs[hwirq];

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

* [irqchip: irq/irqchip-fixes] irqchip/stm32-exti: Remove check on always false condition
  2022-08-17 12:57   ` Antonio Borneo
  (?)
  (?)
@ 2022-09-13 12:53   ` irqchip-bot for Antonio Borneo
  -1 siblings, 0 replies; 7+ messages in thread
From: irqchip-bot for Antonio Borneo @ 2022-09-13 12:53 UTC (permalink / raw)
  To: linux-kernel
  Cc: kernel test robot, Dan Carpenter, Antonio Borneo, Marc Zyngier, tglx

The following commit has been merged into the irq/irqchip-fixes branch of irqchip:

Commit-ID:     8fc7a6198a80bc39b6c5b3cc1a578e7d24f068a2
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/8fc7a6198a80bc39b6c5b3cc1a578e7d24f068a2
Author:        Antonio Borneo <antonio.borneo@foss.st.com>
AuthorDate:    Wed, 17 Aug 2022 14:57:58 +02:00
Committer:     Marc Zyngier <maz@kernel.org>
CommitterDate: Mon, 12 Sep 2022 16:31:25 +01:00

irqchip/stm32-exti: Remove check on always false condition

The field drv_data is assigned during driver's probe, where it's
already checked to be not NULL.

Remove the always false check '!host_data->drv_data'.

This fixes a warning "variable dereferenced before check" detected
by '0-DAY CI Kernel Test Service'.

Fixes: c297493336b7 ("irqchip/stm32-exti: Simplify irq description table")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/lkml/202208131739.gJvcs9ls-lkp@intel.com/
Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220817125758.5975-1-antonio.borneo@foss.st.com
---
 drivers/irqchip/irq-stm32-exti.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c
index a73763d..6a3f749 100644
--- a/drivers/irqchip/irq-stm32-exti.c
+++ b/drivers/irqchip/irq-stm32-exti.c
@@ -716,7 +716,7 @@ static int stm32_exti_h_domain_alloc(struct irq_domain *dm,
 
 	irq_domain_set_hwirq_and_chip(dm, virq, hwirq, chip, chip_data);
 
-	if (!host_data->drv_data || !host_data->drv_data->desc_irqs)
+	if (!host_data->drv_data->desc_irqs)
 		return -EINVAL;
 
 	desc_irq = host_data->drv_data->desc_irqs[hwirq];

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

end of thread, other threads:[~2022-09-13 12:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-13  9:42 drivers/irqchip/irq-stm32-exti.c:719 stm32_exti_h_domain_alloc() warn: variable dereferenced before check 'host_data->drv_data' (see line 707) kernel test robot
2022-08-15  6:51 ` Dan Carpenter
2022-08-15  6:51 ` Dan Carpenter
2022-08-17 12:57 ` [PATCH] irqchip/stm32-exti: Remove check on always false condition Antonio Borneo
2022-08-17 12:57   ` Antonio Borneo
2022-08-17 13:42   ` [irqchip: irq/irqchip-fixes] " irqchip-bot for Antonio Borneo
2022-09-13 12:53   ` irqchip-bot for Antonio Borneo

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.