[bug report] ublk: enable zoned storage support

From: Dan Carpenter <hidden>
Date: 2023-08-10 10:35:51

Hello Andreas Hindborg,

This is a semi-automatic email about new static checker warnings.

The patch 29802d7ca33b: "ublk: enable zoned storage support" from Aug
4, 2023, leads to the following Smatch complaint:

    drivers/block/ublk_drv.c:1404 ublk_commit_completion()
    warn: variable dereferenced before check 'req' (see line 1401)

drivers/block/ublk_drv.c
  1398          /* find the io request and complete */
  1399          req = blk_mq_tag_to_rq(ub->tag_set.tags[qid], tag);
  1400  
  1401          if (req_op(req) == REQ_OP_ZONE_APPEND)
                           ^^^
The patch adds an unchecked dereference

  1402                  req->__sector = ub_cmd->zone_append_lba;
  1403  
  1404          if (req && likely(!blk_should_fake_timeout(req->q)))
                    ^^^
The existing code assumes req can be NULL

  1405                  ublk_put_req_ref(ubq, req);
  1406  }

regards,
dan carpenter
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help