lkml.org 
[lkml]   [2012]   [Jul]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    Subjectre: pstore/ram: Add ftrace messages handling
    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



    \
     
     \ /
      Last update: 2012-07-19 17:01    [W:0.024 / U:0.044 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site