public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* re: null_blk: multi queue aware block test driver
@ 2013-11-05 20:21 Dan Carpenter
  2013-11-05 20:22 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-11-05 20:21 UTC (permalink / raw)
  To: kernel-janitors

Hello Jens Axboe,

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

The patch f2298c0403b0: "null_blk: multi queue aware block test 
driver" from Oct 25, 2013, leads to the following Smatch complaint:

drivers/block/null_blk.c:524 null_add_dev()
	 warn: variable dereferenced before check 'nullb->q' (see line 523)

drivers/block/null_blk.c
   522			nullb->q = blk_init_queue_node(null_request_fn, &nullb->lock, home_node);
   523			blk_queue_prep_rq(nullb->q, null_rq_prep_fn);
                                          ^^^^^^^^
Dereference.

   524			if (nullb->q)
                            ^^^^^^^^
Null check.

   525				blk_queue_softirq_done(nullb->q, null_softirq_done_fn);
   526		}

regards,
dan carpenter

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

* re: null_blk: multi queue aware block test driver
  2013-11-05 20:21 null_blk: multi queue aware block test driver Dan Carpenter
@ 2013-11-05 20:22 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2013-11-05 20:22 UTC (permalink / raw)
  To: kernel-janitors

Hello Jens Axboe,

The patch f2298c0403b0: "null_blk: multi queue aware block test 
driver" from Oct 25, 2013, leads to the following
static checker warning: "drivers/block/null_blk.c:531 null_add_dev()
	 error: 'nullb->q' dereferencing possible ERR_PTR()"

drivers/block/null_blk.c
   513  
   514                          null_mq_reg.nr_hw_queues = submit_queues;
   515                  }
   516  
   517                  nullb->q = blk_mq_init_queue(&null_mq_reg, nullb);
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
blk_mq_init_queue() returns an ERR_PTR on error.

   518          } else if (queue_mode = NULL_Q_BIO) {
   519                  nullb->q = blk_alloc_queue_node(GFP_KERNEL, home_node);
   520                  blk_queue_make_request(nullb->q, null_queue_bio);
   521          } else {
   522                  nullb->q = blk_init_queue_node(null_request_fn, &nullb->lock, home_node);
   523                  blk_queue_prep_rq(nullb->q, null_rq_prep_fn);
   524                  if (nullb->q)
   525                          blk_queue_softirq_done(nullb->q, null_softirq_done_fn);
   526          }
   527  
   528          if (!nullb->q)
   529                  goto queue_fail;
   530  
   531          nullb->q->queuedata = nullb;
                ^^^^^^^^^^^^^^^^^^^
Dereference.

   532          queue_flag_set_unlocked(QUEUE_FLAG_NONROT, nullb->q);

regards,
dan carpenter


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

end of thread, other threads:[~2013-11-05 20:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-05 20:21 null_blk: multi queue aware block test driver Dan Carpenter
2013-11-05 20:22 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox