All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [isilence:iou/discard 13/13] block/ioctl.c:206 blkdev_cmd_queue_discard() error: we previously assumed 'bio' could be null (see line 199)
Date: Wed, 31 Jul 2024 23:25:42 +0800	[thread overview]
Message-ID: <202407312305.YVmb427T-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Pavel Begunkov <asml.silence@gmail.com>

tree:   https://github.com/isilence/linux iou/discard
head:   444b80e47399c01839870b7d75c968fc0e438b29
commit: 444b80e47399c01839870b7d75c968fc0e438b29 [13/13] block: implement io_uring discard cmd
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: x86_64-randconfig-161-20240730 (https://download.01.org/0day-ci/archive/20240731/202407312305.YVmb427T-lkp@intel.com/config)
compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0

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

smatch warnings:
block/ioctl.c:206 blkdev_cmd_queue_discard() error: we previously assumed 'bio' could be null (see line 199)

vim +/bio +206 block/ioctl.c

d30a2605be9d51 David Woodhouse 2008-08-11  175  
444b80e47399c0 Pavel Begunkov  2024-07-20  176  int blkdev_cmd_queue_discard(struct io_uring_cmd *cmd,
444b80e47399c0 Pavel Begunkov  2024-07-20  177  			     uint64_t start, uint64_t len, bool nowait,
444b80e47399c0 Pavel Begunkov  2024-07-20  178  			     void (*end_io)(struct bio *))
444b80e47399c0 Pavel Begunkov  2024-07-20  179  {
444b80e47399c0 Pavel Begunkov  2024-07-20  180  	struct file *file = cmd->file;
444b80e47399c0 Pavel Begunkov  2024-07-20  181  	struct block_device *bdev = I_BDEV(file->f_mapping->host);
444b80e47399c0 Pavel Begunkov  2024-07-20  182  	sector_t sector = start >> SECTOR_SHIFT;
444b80e47399c0 Pavel Begunkov  2024-07-20  183  	sector_t nr_sects = len >> SECTOR_SHIFT;
444b80e47399c0 Pavel Begunkov  2024-07-20  184  	struct bio *prev = NULL, *bio;
444b80e47399c0 Pavel Begunkov  2024-07-20  185  	int err;
444b80e47399c0 Pavel Begunkov  2024-07-20  186  
444b80e47399c0 Pavel Begunkov  2024-07-20  187  	err = blk_check_discard(bdev, file_to_blk_mode(file), start, len);
444b80e47399c0 Pavel Begunkov  2024-07-20  188  	if (err)
444b80e47399c0 Pavel Begunkov  2024-07-20  189  		return err;
444b80e47399c0 Pavel Begunkov  2024-07-20  190  
444b80e47399c0 Pavel Begunkov  2024-07-20  191  	err = filemap_invalidate_pages(bdev->bd_mapping, start,
444b80e47399c0 Pavel Begunkov  2024-07-20  192  					start + len - 1, nowait);
444b80e47399c0 Pavel Begunkov  2024-07-20  193  	if (err)
444b80e47399c0 Pavel Begunkov  2024-07-20  194  		return err;
444b80e47399c0 Pavel Begunkov  2024-07-20  195  
444b80e47399c0 Pavel Begunkov  2024-07-20  196  	while (1) {
444b80e47399c0 Pavel Begunkov  2024-07-20  197  		bio = blk_alloc_discard_bio(bdev, &sector, &nr_sects,
444b80e47399c0 Pavel Begunkov  2024-07-20  198  					    GFP_KERNEL);
444b80e47399c0 Pavel Begunkov  2024-07-20 @199  		if (!bio)
444b80e47399c0 Pavel Begunkov  2024-07-20  200  			break;
444b80e47399c0 Pavel Begunkov  2024-07-20  201  		if (nowait)
444b80e47399c0 Pavel Begunkov  2024-07-20  202  			bio->bi_opf |= REQ_NOWAIT;
444b80e47399c0 Pavel Begunkov  2024-07-20  203  		prev = bio_chain_and_submit(prev, bio);
444b80e47399c0 Pavel Begunkov  2024-07-20  204  	}
444b80e47399c0 Pavel Begunkov  2024-07-20  205  
444b80e47399c0 Pavel Begunkov  2024-07-20 @206  	bio->bi_private = cmd;
444b80e47399c0 Pavel Begunkov  2024-07-20  207  	bio->bi_end_io = end_io;
444b80e47399c0 Pavel Begunkov  2024-07-20  208  
444b80e47399c0 Pavel Begunkov  2024-07-20  209  	if (nr_sects) {
444b80e47399c0 Pavel Begunkov  2024-07-20  210  		bio->bi_status = BLK_STS_AGAIN;
444b80e47399c0 Pavel Begunkov  2024-07-20  211  		bio_put(bio);
444b80e47399c0 Pavel Begunkov  2024-07-20  212  		return -EIOCBQUEUED;
444b80e47399c0 Pavel Begunkov  2024-07-20  213  	}
444b80e47399c0 Pavel Begunkov  2024-07-20  214  	submit_bio(bio);
444b80e47399c0 Pavel Begunkov  2024-07-20  215  	return -EIOCBQUEUED;
444b80e47399c0 Pavel Begunkov  2024-07-20  216  }
444b80e47399c0 Pavel Begunkov  2024-07-20  217  

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

             reply	other threads:[~2024-07-31 15:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-31 15:25 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-07-31 16:05 [isilence:iou/discard 13/13] block/ioctl.c:206 blkdev_cmd_queue_discard() error: we previously assumed 'bio' could be null (see line 199) Dan Carpenter
2024-08-02 12:00 ` Pavel Begunkov

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=202407312305.YVmb427T-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.