CC: kbuild-...@lists.01.org
In-Reply-To: <20210416194709.155497-1-egran...@google.com>
References: <20210416194709.155497-1-egran...@google.com>
TO: Enrico Granata <egran...@google.com>

Hi Enrico,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on block/for-next]
[also build test WARNING on linus/master v5.12-rc8]
[cannot apply to vhost/linux-next next-20210421]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    
https://github.com/0day-ci/linux/commits/Enrico-Granata/virtio_blk-Add-support-for-lifetime-feature/20210417-034754
base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git 
for-next
:::::: branch date: 5 days ago
:::::: commit date: 5 days ago
config: i386-randconfig-m021-20210421 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <l...@intel.com>
Reported-by: Dan Carpenter <dan.carpen...@oracle.com>

New smatch warnings:
drivers/block/virtio_blk.c:256 virtio_queue_rq() error: uninitialized symbol 
'type'.

Old smatch warnings:
drivers/block/virtio_blk.c:258 virtio_queue_rq() error: uninitialized symbol 
'type'.

vim +/type +256 drivers/block/virtio_blk.c

944e7c87967c82 Jens Axboe         2018-11-26  216  
fc17b6534eb839 Christoph Hellwig  2017-06-03  217  static blk_status_t 
virtio_queue_rq(struct blk_mq_hw_ctx *hctx,
74c450521dd8d2 Jens Axboe         2014-10-29  218                          
const struct blk_mq_queue_data *bd)
e467cde238184d Rusty Russell      2007-10-22  219  {
1cf7e9c68fe842 Jens Axboe         2013-11-01  220       struct virtio_blk *vblk 
= hctx->queue->queuedata;
74c450521dd8d2 Jens Axboe         2014-10-29  221       struct request *req = 
bd->rq;
9d74e25737d73e Christoph Hellwig  2014-04-14  222       struct virtblk_req *vbr 
= blk_mq_rq_to_pdu(req);
1cf7e9c68fe842 Jens Axboe         2013-11-01  223       unsigned long flags;
20af3cfd20145f Paolo Bonzini      2013-03-20  224       unsigned int num;
6a27b656fc0210 Ming Lei           2014-06-26  225       int qid = 
hctx->queue_num;
5261b85e586afe Rusty Russell      2014-03-13  226       int err;
e8edca6f7f9223 Ming Lei           2014-05-30  227       bool notify = false;
1f23816b8eb8fd Changpeng Liu      2018-11-01  228       bool unmap = false;
aebf526b53aea1 Christoph Hellwig  2017-01-31  229       u32 type;
e467cde238184d Rusty Russell      2007-10-22  230  
1cf7e9c68fe842 Jens Axboe         2013-11-01  231       
BUG_ON(req->nr_phys_segments + 2 > vblk->sg_elems);
e467cde238184d Rusty Russell      2007-10-22  232  
aebf526b53aea1 Christoph Hellwig  2017-01-31  233       switch (req_op(req)) {
aebf526b53aea1 Christoph Hellwig  2017-01-31  234       case REQ_OP_READ:
aebf526b53aea1 Christoph Hellwig  2017-01-31  235       case REQ_OP_WRITE:
aebf526b53aea1 Christoph Hellwig  2017-01-31  236               type = 0;
f1b0ef06260271 Christoph Hellwig  2009-09-17  237               break;
aebf526b53aea1 Christoph Hellwig  2017-01-31  238       case REQ_OP_FLUSH:
aebf526b53aea1 Christoph Hellwig  2017-01-31  239               type = 
VIRTIO_BLK_T_FLUSH;
f1b0ef06260271 Christoph Hellwig  2009-09-17  240               break;
1f23816b8eb8fd Changpeng Liu      2018-11-01  241       case REQ_OP_DISCARD:
1f23816b8eb8fd Changpeng Liu      2018-11-01  242               type = 
VIRTIO_BLK_T_DISCARD;
1f23816b8eb8fd Changpeng Liu      2018-11-01  243               break;
1f23816b8eb8fd Changpeng Liu      2018-11-01  244       case 
REQ_OP_WRITE_ZEROES:
1f23816b8eb8fd Changpeng Liu      2018-11-01  245               type = 
VIRTIO_BLK_T_WRITE_ZEROES;
1f23816b8eb8fd Changpeng Liu      2018-11-01  246               unmap = 
!(req->cmd_flags & REQ_NOUNMAP);
1f23816b8eb8fd Changpeng Liu      2018-11-01  247               break;
aebf526b53aea1 Christoph Hellwig  2017-01-31  248       case REQ_OP_DRV_IN:
fc90f60f9bc3b5 Enrico Granata     2021-04-16  249               break; /* type 
already set for custom requests */
f1b0ef06260271 Christoph Hellwig  2009-09-17  250       default:
aebf526b53aea1 Christoph Hellwig  2017-01-31  251               WARN_ON_ONCE(1);
fc17b6534eb839 Christoph Hellwig  2017-06-03  252               return 
BLK_STS_IOERR;
dd40e456a40ebb FUJITA Tomonori    2010-07-03  253       }
e467cde238184d Rusty Russell      2007-10-22  254  
fc90f60f9bc3b5 Enrico Granata     2021-04-16  255       if (req_op(req) != 
REQ_OP_DRV_IN)
aebf526b53aea1 Christoph Hellwig  2017-01-31 @256               
vbr->out_hdr.type = cpu_to_virtio32(vblk->vdev, type);
fc90f60f9bc3b5 Enrico Granata     2021-04-16  257  
aebf526b53aea1 Christoph Hellwig  2017-01-31  258       vbr->out_hdr.sector = 
type ?
aebf526b53aea1 Christoph Hellwig  2017-01-31  259               0 : 
cpu_to_virtio64(vblk->vdev, blk_rq_pos(req));
aebf526b53aea1 Christoph Hellwig  2017-01-31  260       vbr->out_hdr.ioprio = 
cpu_to_virtio32(vblk->vdev, req_get_ioprio(req));
aebf526b53aea1 Christoph Hellwig  2017-01-31  261  
e2490073cd7c3d Christoph Hellwig  2014-09-13  262       
blk_mq_start_request(req);
e2490073cd7c3d Christoph Hellwig  2014-09-13  263  
1f23816b8eb8fd Changpeng Liu      2018-11-01  264       if (type == 
VIRTIO_BLK_T_DISCARD || type == VIRTIO_BLK_T_WRITE_ZEROES) {
1f23816b8eb8fd Changpeng Liu      2018-11-01  265               err = 
virtblk_setup_discard_write_zeroes(req, unmap);
1f23816b8eb8fd Changpeng Liu      2018-11-01  266               if (err)
1f23816b8eb8fd Changpeng Liu      2018-11-01  267                       return 
BLK_STS_RESOURCE;
1f23816b8eb8fd Changpeng Liu      2018-11-01  268       }
1f23816b8eb8fd Changpeng Liu      2018-11-01  269  
85dada09eeb31c Christoph Hellwig  2017-01-28  270       num = 
blk_rq_map_sg(hctx->queue, req, vbr->sg);
1cde26f928863d Hannes Reinecke    2009-05-18  271       if (num) {
85dada09eeb31c Christoph Hellwig  2017-01-28  272               if 
(rq_data_dir(req) == WRITE)
19c1c5a64c3b8e Michael S. Tsirkin 2014-10-07  273                       
vbr->out_hdr.type |= cpu_to_virtio32(vblk->vdev, VIRTIO_BLK_T_OUT);
20af3cfd20145f Paolo Bonzini      2013-03-20  274               else
19c1c5a64c3b8e Michael S. Tsirkin 2014-10-07  275                       
vbr->out_hdr.type |= cpu_to_virtio32(vblk->vdev, VIRTIO_BLK_T_IN);
e467cde238184d Rusty Russell      2007-10-22  276       }
e467cde238184d Rusty Russell      2007-10-22  277  
6a27b656fc0210 Ming Lei           2014-06-26  278       
spin_lock_irqsave(&vblk->vqs[qid].lock, flags);
97b50a654d5de5 Christoph Hellwig  2017-01-28  279       err = 
virtblk_add_req(vblk->vqs[qid].vq, vbr, vbr->sg, num);
5261b85e586afe Rusty Russell      2014-03-13  280       if (err) {
6a27b656fc0210 Ming Lei           2014-06-26  281               
virtqueue_kick(vblk->vqs[qid].vq);
f5f6b95c72f7f8 Halil Pasic        2020-02-13  282               /* Don't stop 
the queue if -ENOMEM: we may have failed to
f5f6b95c72f7f8 Halil Pasic        2020-02-13  283                * bounce the 
buffer due to global resource outage.
f5f6b95c72f7f8 Halil Pasic        2020-02-13  284                */
f5f6b95c72f7f8 Halil Pasic        2020-02-13  285               if (err == 
-ENOSPC)
1cf7e9c68fe842 Jens Axboe         2013-11-01  286                       
blk_mq_stop_hw_queue(hctx);
6a27b656fc0210 Ming Lei           2014-06-26  287               
spin_unlock_irqrestore(&vblk->vqs[qid].lock, flags);
3d973b2e9a6259 Halil Pasic        2020-02-13  288               switch (err) {
3d973b2e9a6259 Halil Pasic        2020-02-13  289               case -ENOSPC:
86ff7c2a80cd35 Ming Lei           2018-01-30  290                       return 
BLK_STS_DEV_RESOURCE;
3d973b2e9a6259 Halil Pasic        2020-02-13  291               case -ENOMEM:
3d973b2e9a6259 Halil Pasic        2020-02-13  292                       return 
BLK_STS_RESOURCE;
3d973b2e9a6259 Halil Pasic        2020-02-13  293               default:
fc17b6534eb839 Christoph Hellwig  2017-06-03  294                       return 
BLK_STS_IOERR;
e467cde238184d Rusty Russell      2007-10-22  295               }
3d973b2e9a6259 Halil Pasic        2020-02-13  296       }
e467cde238184d Rusty Russell      2007-10-22  297  
74c450521dd8d2 Jens Axboe         2014-10-29  298       if (bd->last && 
virtqueue_kick_prepare(vblk->vqs[qid].vq))
e8edca6f7f9223 Ming Lei           2014-05-30  299               notify = true;
6a27b656fc0210 Ming Lei           2014-06-26  300       
spin_unlock_irqrestore(&vblk->vqs[qid].lock, flags);
e8edca6f7f9223 Ming Lei           2014-05-30  301  
e8edca6f7f9223 Ming Lei           2014-05-30  302       if (notify)
6a27b656fc0210 Ming Lei           2014-06-26  303               
virtqueue_notify(vblk->vqs[qid].vq);
fc17b6534eb839 Christoph Hellwig  2017-06-03  304       return BLK_STS_OK;
a98755c559e0e9 Asias He           2012-08-08  305  }
a98755c559e0e9 Asias He           2012-08-08  306  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org

Reply via email to