lkml.org 
[lkml]   [2021]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectarch/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@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@lists.01.org
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2021-02-27 10:33    [W:0.048 / U:2.660 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site