re: pstore/ram: Add ftrace messages handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Anton Vorontsov,

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

The patch a694d1b5916a: "pstore/ram: Add ftrace messages handling" 
from Jul 9, 2012, leads to the following Smatch complaint:

fs/pstore/ram.c:423 ramoops_probe()
	 error: we previously assumed 'cxt->cprz' could be null (see line 408)

fs/pstore/ram.c
   407	
   408		if (!cxt->przs && !cxt->cprz && !cxt->fprz) {
                                  ^^^^^^^^^^

Checked here.

   409			pr_err("memory size too small, minimum is %lu\n",
   410				cxt->console_size + cxt->record_size +
   411				cxt->ftrace_size);
   412			goto fail_cnt;
   413		}
   414	
   415		cxt->pstore.data = cxt;
   416		/*
   417		 * Console can handle any buffer size, so prefer dumps buffer
   418		 * size since usually it is smaller.
   419		 */
   420		if (cxt->przs)
   421			cxt->pstore.bufsize = cxt->przs[0]->buffer_size;
   422		else
   423			cxt->pstore.bufsize = cxt->cprz->buffer_size;
                                              ^^^^^^^^^
Dereferenced here.  What about if only "cxt->fprz" is non-NULL?

Also these are crap variable names, "przs" and "cprz" look so similar.
It makes my head hurt to keep them appart.

   424		cxt->pstore.buf = kmalloc(cxt->pstore.bufsize, GFP_KERNEL);
   425		spin_lock_init(&cxt->pstore.buf_lock);

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux