All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] nullb: factor disk parameters
@ 2017-08-25 20:24 Dan Carpenter
  2017-08-25 20:33 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-08-25 20:24 UTC (permalink / raw)
  To: shli; +Cc: Shaohua Li, linux-block

Hello Shaohua Li,

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

The patch 2984c8684f96: "nullb: factor disk parameters" from Aug 14, 
2017, leads to the following Smatch complaint:

drivers/block/null_blk.c:1759 null_init_tag_set()
	 error: we previously assumed 'nullb' could be null (see line 1750)

drivers/block/null_blk.c
  1749		set->ops = &null_mq_ops;
  1750		set->nr_hw_queues = nullb ? nullb->dev->submit_queues :
  1751							g_submit_queues;
  1752		set->queue_depth = nullb ? nullb->dev->hw_queue_depth :
  1753							g_hw_queue_depth;
  1754		set->numa_node = nullb ? nullb->dev->home_node : g_home_node;
                                 ^^^^^
The patch introduces a series of new NULL checks

  1755		set->cmd_size	= sizeof(struct nullb_cmd);
  1756		set->flags = BLK_MQ_F_SHOULD_MERGE;
  1757		set->driver_data = NULL;
  1758	
  1759		if (nullb->dev->blocking)
                    ^^^^^^^^^^^^^^^^^^^^
And an unchecked dereference.

  1760			set->flags |= BLK_MQ_F_BLOCKING;
  1761	

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bug report] nullb: factor disk parameters
  2017-08-25 20:24 [bug report] nullb: factor disk parameters Dan Carpenter
@ 2017-08-25 20:33 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2017-08-25 20:33 UTC (permalink / raw)
  To: Dan Carpenter, shli; +Cc: linux-block

On 08/25/2017 02:24 PM, Dan Carpenter wrote:
> Hello Shaohua Li,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch 2984c8684f96: "nullb: factor disk parameters" from Aug 14, 
> 2017, leads to the following Smatch complaint:
> 
> drivers/block/null_blk.c:1759 null_init_tag_set()
> 	 error: we previously assumed 'nullb' could be null (see line 1750)

That's a bug, for shared tags we passed in nullb == NULL.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-25 20:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-25 20:24 [bug report] nullb: factor disk parameters Dan Carpenter
2017-08-25 20:33 ` Jens Axboe

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.