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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 27 Feb 2021 12:30:50 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org,
        Cédric Le Goater <clg@...d.org>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org,
        Michael Ellerman <mpe@...erman.id.au>,
        Greg Kurz <groug@...d.org>
Subject: arch/powerpc/sysdev/xive/common.c:279 xmon_xive_get_irq_config()
 warn: variable dereferenced before check 'd' (see line 261)

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@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.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@lists.01.org

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ