Hi Hannes, I love your patch! Perhaps something to improve: [auto build test WARNING on mkp-scsi/for-next] [also build test WARNING on scsi/for-next v5.7-rc7 next-20200529] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Hannes-Reinecke/scsi-use-xarray-for-devices-and-targets/20200527-231824 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next config: x86_64-randconfig-m001-20200529 (attached as .config) compiler: gcc-9 (Debian 9.3.0-13) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kbuild test robot New smatch warnings: drivers/scsi/scsi_sysfs.c:1625 scsi_sysfs_device_initialize() warn: always true condition '(sdev->lun_idx != -1) => (0-u32max != u64max)' Old smatch warnings: drivers/scsi/scsi_sysfs.c:437 scsi_device_dev_release_usercontext() error: potentially dereferencing uninitialized 'sdev'. vim +1625 drivers/scsi/scsi_sysfs.c 1592 1593 void scsi_sysfs_device_initialize(struct scsi_device *sdev) 1594 { 1595 unsigned long flags; 1596 struct Scsi_Host *shost = sdev->host; 1597 struct scsi_target *starget = sdev->sdev_target; 1598 1599 device_initialize(&sdev->sdev_gendev); 1600 sdev->sdev_gendev.bus = &scsi_bus_type; 1601 sdev->sdev_gendev.type = &scsi_dev_type; 1602 dev_set_name(&sdev->sdev_gendev, "%d:%d:%d:%llu", 1603 sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); 1604 1605 device_initialize(&sdev->sdev_dev); 1606 sdev->sdev_dev.parent = get_device(&sdev->sdev_gendev); 1607 sdev->sdev_dev.class = &sdev_class; 1608 dev_set_name(&sdev->sdev_dev, "%d:%d:%d:%llu", 1609 sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); 1610 /* 1611 * Get a default scsi_level from the target (derived from sibling 1612 * devices). This is the best we can do for guessing how to set 1613 * sdev->lun_in_cdb for the initial INQUIRY command. For LUN 0 the 1614 * setting doesn't matter, because all the bits are zero anyway. 1615 * But it does matter for higher LUNs. 1616 */ 1617 sdev->scsi_level = starget->scsi_level; 1618 if (sdev->scsi_level <= SCSI_2 && 1619 sdev->scsi_level != SCSI_UNKNOWN && 1620 !shost->no_scsi2_lun_in_cdb) 1621 sdev->lun_in_cdb = 1; 1622 1623 transport_setup_device(&sdev->sdev_gendev); 1624 spin_lock_irqsave(shost->host_lock, flags); > 1625 if (sdev->lun_idx != (unsigned long)-1) 1626 WARN_ON(!xa_insert(&starget->devices, sdev->lun_idx, 1627 sdev, GFP_KERNEL)); 1628 else { 1629 struct xa_limit scsi_lun_limit = { 1630 .min = 256, 1631 .max = UINT_MAX, 1632 }; 1633 WARN_ON(!xa_alloc(&starget->devices, &sdev->lun_idx, 1634 sdev, scsi_lun_limit, GFP_KERNEL)); 1635 } 1636 list_add_tail(&sdev->siblings, &shost->__devices); 1637 spin_unlock_irqrestore(shost->host_lock, flags); 1638 /* 1639 * device can now only be removed via __scsi_remove_device() so hold 1640 * the target. Target will be held in CREATED state until something 1641 * beneath it becomes visible (in which case it moves to RUNNING) 1642 */ 1643 kref_get(&starget->reap_ref); 1644 } 1645 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org