Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: oe-kbuild@lists.linux.dev, Maurizio Lombardi <mlombard@redhat.com>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	linux-nvme@lists.infradead.org, Keith Busch <kbusch@kernel.org>,
	Daniel Wagner <dwagner@suse.de>,
	Mohamed Khalfella <mkhalfella@purestorage.com>,
	Hannes Reinecke <hare@kernel.org>, Christoph Hellwig <hch@lst.de>
Subject: [linux-nvme:nvme-7.2 2/7] drivers/nvme/host/core.c:5259 nvme_wait_freeze_timeout() warn: 'timeout' unsigned <= 0
Date: Thu, 21 May 2026 09:43:35 +0300	[thread overview]
Message-ID: <202605211257.STzj2Ujv-lkp@intel.com> (raw)

tree:   git://git.infradead.org/nvme.git nvme-7.2
head:   00d7b33351aac0ea55d17167561e12bbeca73138
commit: 23b6d2cbf75ff15647efbb7c0e5c03bd7ed1fe1a [2/7] nvme: remove redundant timeout argument from nvme_wait_freeze_timeout
config: s390-randconfig-r073-20260521 (https://download.01.org/0day-ci/archive/20260521/202605211257.STzj2Ujv-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
smatch: v0.5.0-9185-gbcc58b9c

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202605211257.STzj2Ujv-lkp@intel.com/

smatch warnings:
drivers/nvme/host/core.c:5259 nvme_wait_freeze_timeout() warn: 'timeout' unsigned <= 0

vim +/timeout +5259 drivers/nvme/host/core.c

23b6d2cbf75ff15 Maurizio Lombardi 2026-05-14  5249  int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl)
302ad8cc09339ea Keith Busch       2017-03-01  5250  {
23b6d2cbf75ff15 Maurizio Lombardi 2026-05-14  5251  	unsigned long timeout = NVME_IO_TIMEOUT;
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is unsigned.  NVME_IO_TIMEOUT is 30 * HZ.  Can the &ctrl->namespaces
list ever be empty?

302ad8cc09339ea Keith Busch       2017-03-01  5252  	struct nvme_ns *ns;
be647e2c76b27f4 Keith Busch       2024-05-21  5253  	int srcu_idx;
302ad8cc09339ea Keith Busch       2017-03-01  5254  
be647e2c76b27f4 Keith Busch       2024-05-21  5255  	srcu_idx = srcu_read_lock(&ctrl->srcu);
6d1c69945ce63a9 Breno Leitao      2024-11-04  5256  	list_for_each_entry_srcu(ns, &ctrl->namespaces, list,
6d1c69945ce63a9 Breno Leitao      2024-11-04  5257  				 srcu_read_lock_held(&ctrl->srcu)) {
302ad8cc09339ea Keith Busch       2017-03-01  5258  		timeout = blk_mq_freeze_queue_wait_timeout(ns->queue, timeout);
302ad8cc09339ea Keith Busch       2017-03-01 @5259  		if (timeout <= 0)

blk_mq_freeze_queue_wait_timeout() returns 0 on timeout and >= 1 on
success.

302ad8cc09339ea Keith Busch       2017-03-01  5260  			break;
302ad8cc09339ea Keith Busch       2017-03-01  5261  	}
be647e2c76b27f4 Keith Busch       2024-05-21  5262  	srcu_read_unlock(&ctrl->srcu, srcu_idx);
7cf0d7c0f3c3b02 Sagi Grimberg     2020-07-30  5263  	return timeout;

This returns is nonsense.  ;)  >= 1 on success or empty.  0 on timeout.

302ad8cc09339ea Keith Busch       2017-03-01  5264  }

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



             reply	other threads:[~2026-05-21  6:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21  6:43 Dan Carpenter [this message]
2026-05-21  7:47 ` [linux-nvme:nvme-7.2 2/7] drivers/nvme/host/core.c:5259 nvme_wait_freeze_timeout() warn: 'timeout' unsigned <= 0 Maurizio Lombardi
2026-05-21  8:21 ` Maurizio Lombardi

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=202605211257.STzj2Ujv-lkp@intel.com \
    --to=error27@gmail.com \
    --cc=dwagner@suse.de \
    --cc=hare@kernel.org \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=lkp@intel.com \
    --cc=mkhalfella@purestorage.com \
    --cc=mlombard@redhat.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    /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