All of lore.kernel.org
 help / color / mirror / Atom feed
* arch/powerpc/sysdev/xive/common.c:279 xmon_xive_get_irq_config() warn: variable dereferenced before check 'd' (see line 261)
@ 2021-02-27  9:30 ` Dan Carpenter
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2021-02-27  9:30 UTC (permalink / raw)
  To: kbuild

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   8b83369ddcb3fb9cab5c1088987ce477565bb630
commit: 97ef275077932c65b1b8ec5022abd737a9fbf3e0 powerpc/xive: Fix xmon support on the PowerNV platform
config: powerpc64-randconfig-m031-20210226 (attached as .config)
compiler: powerpc64-linux-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:
arch/powerpc/sysdev/xive/common.c:279 xmon_xive_get_irq_config() warn: variable dereferenced before check 'd' (see line 261)

vim +/d +279 arch/powerpc/sysdev/xive/common.c

5896163f7f91c05 Cédric Le Goater 2019-09-10  259  int xmon_xive_get_irq_config(u32 hw_irq, struct irq_data *d)
b4868ff55d082bc Cédric Le Goater 2019-08-14  260  {
97ef275077932c6 Cédric Le Goater 2020-03-06 @261  	struct irq_chip *chip = irq_data_get_irq_chip(d);
                                                                                                      ^
Dereferenced inside function

5896163f7f91c05 Cédric Le Goater 2019-09-10  262  	int rc;
5896163f7f91c05 Cédric Le Goater 2019-09-10  263  	u32 target;
5896163f7f91c05 Cédric Le Goater 2019-09-10  264  	u8 prio;
5896163f7f91c05 Cédric Le Goater 2019-09-10  265  	u32 lirq;
5896163f7f91c05 Cédric Le Goater 2019-09-10  266  
97ef275077932c6 Cédric Le Goater 2020-03-06  267  	if (!is_xive_irq(chip))
97ef275077932c6 Cédric Le Goater 2020-03-06  268  		return -EINVAL;
97ef275077932c6 Cédric Le Goater 2020-03-06  269  
5896163f7f91c05 Cédric Le Goater 2019-09-10  270  	rc = xive_ops->get_irq_config(hw_irq, &target, &prio, &lirq);
5896163f7f91c05 Cédric Le Goater 2019-09-10  271  	if (rc) {
5896163f7f91c05 Cédric Le Goater 2019-09-10  272  		xmon_printf("IRQ 0x%08x : no config rc=%d\n", hw_irq, rc);
5896163f7f91c05 Cédric Le Goater 2019-09-10  273  		return rc;
5896163f7f91c05 Cédric Le Goater 2019-09-10  274  	}
5896163f7f91c05 Cédric Le Goater 2019-09-10  275  
5896163f7f91c05 Cédric Le Goater 2019-09-10  276  	xmon_printf("IRQ 0x%08x : target=0x%x prio=%02x lirq=0x%x ",
5896163f7f91c05 Cédric Le Goater 2019-09-10  277  		    hw_irq, target, prio, lirq);
5896163f7f91c05 Cédric Le Goater 2019-09-10  278  
5896163f7f91c05 Cédric Le Goater 2019-09-10 @279  	if (d) {
                                                        ^^^^^^
Checked too late

5896163f7f91c05 Cédric Le Goater 2019-09-10  280  		struct xive_irq_data *xd = irq_data_get_irq_handler_data(d);
5896163f7f91c05 Cédric Le Goater 2019-09-10  281  		u64 val = xive_esb_read(xd, XIVE_ESB_GET);
5896163f7f91c05 Cédric Le Goater 2019-09-10  282  
5896163f7f91c05 Cédric Le Goater 2019-09-10  283  		xmon_printf("PQ=%c%c",
5896163f7f91c05 Cédric Le Goater 2019-09-10  284  			    val & XIVE_ESB_VAL_P ? 'P' : '-',
5896163f7f91c05 Cédric Le Goater 2019-09-10  285  			    val & XIVE_ESB_VAL_Q ? 'Q' : '-');
5896163f7f91c05 Cédric Le Goater 2019-09-10  286  	}
5896163f7f91c05 Cédric Le Goater 2019-09-10  287  
5896163f7f91c05 Cédric Le Goater 2019-09-10  288  	xmon_printf("\n");
5896163f7f91c05 Cédric Le Goater 2019-09-10  289  	return 0;
b4868ff55d082bc Cédric Le Goater 2019-08-14  290  }

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

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

^ permalink raw reply	[flat|nested] 5+ messages in thread
* arch/powerpc/sysdev/xive/common.c:279 xmon_xive_get_irq_config() warn: variable dereferenced before check 'd' (see line 261)
@ 2021-02-27  0:07 kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-02-27  0:07 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: "Cédric Le Goater" <clg@kaod.org>
CC: Michael Ellerman <mpe@ellerman.id.au>
CC: Greg Kurz <groug@kaod.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   8b83369ddcb3fb9cab5c1088987ce477565bb630
commit: 97ef275077932c65b1b8ec5022abd737a9fbf3e0 powerpc/xive: Fix xmon support on the PowerNV platform
date:   11 months ago
:::::: branch date: 6 hours ago
:::::: commit date: 11 months ago
config: powerpc64-randconfig-m031-20210226 (attached as .config)
compiler: powerpc64-linux-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:
arch/powerpc/sysdev/xive/common.c:279 xmon_xive_get_irq_config() warn: variable dereferenced before check 'd' (see line 261)

vim +/d +279 arch/powerpc/sysdev/xive/common.c

b4868ff55d082bc Cédric Le Goater 2019-08-14  258  
5896163f7f91c05 Cédric Le Goater 2019-09-10  259  int xmon_xive_get_irq_config(u32 hw_irq, struct irq_data *d)
b4868ff55d082bc Cédric Le Goater 2019-08-14  260  {
97ef275077932c6 Cédric Le Goater 2020-03-06 @261  	struct irq_chip *chip = irq_data_get_irq_chip(d);
5896163f7f91c05 Cédric Le Goater 2019-09-10  262  	int rc;
5896163f7f91c05 Cédric Le Goater 2019-09-10  263  	u32 target;
5896163f7f91c05 Cédric Le Goater 2019-09-10  264  	u8 prio;
5896163f7f91c05 Cédric Le Goater 2019-09-10  265  	u32 lirq;
5896163f7f91c05 Cédric Le Goater 2019-09-10  266  
97ef275077932c6 Cédric Le Goater 2020-03-06  267  	if (!is_xive_irq(chip))
97ef275077932c6 Cédric Le Goater 2020-03-06  268  		return -EINVAL;
97ef275077932c6 Cédric Le Goater 2020-03-06  269  
5896163f7f91c05 Cédric Le Goater 2019-09-10  270  	rc = xive_ops->get_irq_config(hw_irq, &target, &prio, &lirq);
5896163f7f91c05 Cédric Le Goater 2019-09-10  271  	if (rc) {
5896163f7f91c05 Cédric Le Goater 2019-09-10  272  		xmon_printf("IRQ 0x%08x : no config rc=%d\n", hw_irq, rc);
5896163f7f91c05 Cédric Le Goater 2019-09-10  273  		return rc;
5896163f7f91c05 Cédric Le Goater 2019-09-10  274  	}
5896163f7f91c05 Cédric Le Goater 2019-09-10  275  
5896163f7f91c05 Cédric Le Goater 2019-09-10  276  	xmon_printf("IRQ 0x%08x : target=0x%x prio=%02x lirq=0x%x ",
5896163f7f91c05 Cédric Le Goater 2019-09-10  277  		    hw_irq, target, prio, lirq);
5896163f7f91c05 Cédric Le Goater 2019-09-10  278  
5896163f7f91c05 Cédric Le Goater 2019-09-10 @279  	if (d) {
5896163f7f91c05 Cédric Le Goater 2019-09-10  280  		struct xive_irq_data *xd = irq_data_get_irq_handler_data(d);
5896163f7f91c05 Cédric Le Goater 2019-09-10  281  		u64 val = xive_esb_read(xd, XIVE_ESB_GET);
5896163f7f91c05 Cédric Le Goater 2019-09-10  282  
5896163f7f91c05 Cédric Le Goater 2019-09-10  283  		xmon_printf("PQ=%c%c",
5896163f7f91c05 Cédric Le Goater 2019-09-10  284  			    val & XIVE_ESB_VAL_P ? 'P' : '-',
5896163f7f91c05 Cédric Le Goater 2019-09-10  285  			    val & XIVE_ESB_VAL_Q ? 'Q' : '-');
5896163f7f91c05 Cédric Le Goater 2019-09-10  286  	}
5896163f7f91c05 Cédric Le Goater 2019-09-10  287  
5896163f7f91c05 Cédric Le Goater 2019-09-10  288  	xmon_printf("\n");
5896163f7f91c05 Cédric Le Goater 2019-09-10  289  	return 0;
b4868ff55d082bc Cédric Le Goater 2019-08-14  290  }
b4868ff55d082bc Cédric Le Goater 2019-08-14  291  

:::::: The code at line 279 was first introduced by commit
:::::: 5896163f7f91c0560cc41908c808661eee4c4121 powerpc/xmon: Improve output of XIVE interrupts

:::::: TO: Cédric Le Goater <clg@kaod.org>
:::::: CC: Michael Ellerman <mpe@ellerman.id.au>

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

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

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

end of thread, other threads:[~2021-03-03 18:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-27  9:30 arch/powerpc/sysdev/xive/common.c:279 xmon_xive_get_irq_config() warn: variable dereferenced before check 'd' (see line 261) Dan Carpenter
2021-02-27  9:30 ` Dan Carpenter
2021-02-27  9:30 ` Dan Carpenter
2021-03-03 13:21 ` Cédric Le Goater
  -- strict thread matches above, loose matches on Subject: below --
2021-02-27  0:07 kernel test robot

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.