re: pstore/ram: Add ftrace messages handling
From: Dan Carpenter
Date: Thu Jul 19 2012 - 10:29:05 EST
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/