public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Hannes Reinecke <hare@suse.de>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: kbuild-all@lists.01.org, Christoph Hellwig <hch@lst.de>,
	Doug Gilbert <dgilbert@interlog.com>,
	Daniel Wagner <daniel.wagner@suse.com>,
	James Bottomley <james.bottomley@hansenpartnership.com>,
	linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>
Subject: Re: [PATCH 3/4] scsi: move target device list to xarray
Date: Sat, 30 May 2020 10:47:26 +0800	[thread overview]
Message-ID: <202005301032.3ukOCsPZ%lkp@intel.com> (raw)
In-Reply-To: <20200527141400.58087-4-hare@suse.de>

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

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 <lkp@intel.com>

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

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

  parent reply	other threads:[~2020-05-30  2:48 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27 14:13 [RFC PATCH 0/4] scsi: use xarray for devices and targets Hannes Reinecke
2020-05-27 14:13 ` [PATCH 1/4] scsi: convert target lookup to xarray Hannes Reinecke
2020-05-27 14:57   ` Johannes Thumshirn
2020-05-27 15:06     ` Hannes Reinecke
2020-05-28  7:24   ` Daniel Wagner
2020-05-28  7:52     ` Hannes Reinecke
2020-05-28 16:28       ` Bart Van Assche
2020-05-29  5:01   ` kbuild test robot
2020-05-31  9:10   ` Dan Carpenter
2020-05-27 14:13 ` [PATCH 2/4] target_core_pscsi: use __scsi_device_lookup() Hannes Reinecke
2020-05-27 15:05   ` Johannes Thumshirn
2020-05-27 14:13 ` [PATCH 3/4] scsi: move target device list to xarray Hannes Reinecke
2020-05-27 15:34   ` Johannes Thumshirn
2020-05-27 20:13   ` kbuild test robot
2020-05-30  2:47   ` kbuild test robot [this message]
2020-05-27 14:14 ` [PATCH 4/4] scsi: remove direct device lookup per host Hannes Reinecke
2020-05-28  8:00   ` kbuild test robot
2020-05-27 16:36 ` [RFC PATCH 0/4] scsi: use xarray for devices and targets Bart Van Assche
2020-05-27 16:59   ` Hannes Reinecke
2020-05-28  3:59   ` Douglas Gilbert
  -- strict thread matches above, loose matches on Subject: below --
2020-05-28  8:42 [PATCHv2 0/4] Hannes Reinecke
2020-05-28  8:42 ` [PATCH 3/4] scsi: move target device list to xarray Hannes Reinecke
2020-05-28 16:36 [PATCHv3 0/4] scsi: use xarray for devices and targets Hannes Reinecke
2020-05-28 16:36 ` [PATCH 3/4] scsi: move target device list to xarray Hannes Reinecke
2020-05-28 17:50   ` Douglas Gilbert
2020-05-28 18:54     ` Matthew Wilcox
2020-05-28 19:44       ` Douglas Gilbert
2020-05-28 19:53         ` Matthew Wilcox
2020-05-29  6:45         ` Hannes Reinecke
2020-05-28 20:58       ` Hannes Reinecke
2020-05-29  0:20         ` Matthew Wilcox
2020-05-29  6:50           ` Hannes Reinecke
2020-05-29 11:21             ` Matthew Wilcox
2020-05-29 12:46               ` Hannes Reinecke
2020-05-29 12:50                 ` Matthew Wilcox
2020-05-29 13:17                   ` Hannes Reinecke
2020-05-29 16:24                 ` Douglas Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202005301032.3ukOCsPZ%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=daniel.wagner@suse.com \
    --cc=dgilbert@interlog.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox