lkml.org 
[lkml]   [2012]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3/7] logfs: fix error return code
    Date
    From: Julia Lawall <Julia.Lawall@lip6.fr>

    Initialize return variable before exiting on an error path.

    A simplified version of the semantic match that finds this problem is as
    follows: (http://coccinelle.lip6.fr/)

    // <smpl>
    (
    if@p1 (\(ret < 0\|ret != 0\))
    { ... return ret; }
    |
    ret@p1 = 0
    )
    ... when != ret = e1
    when != &ret
    *if(...)
    {
    ... when != ret = e2
    when forall
    return ret;
    }

    // </smpl>

    Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

    ---
    fs/logfs/segment.c | 2 ++
    1 file changed, 2 insertions(+)

    diff --git a/fs/logfs/segment.c b/fs/logfs/segment.c
    index 038da09..0cf91e4 100644
    --- a/fs/logfs/segment.c
    +++ b/fs/logfs/segment.c
    @@ -601,6 +601,7 @@ static int __logfs_segment_read(struct inode *inode, void *buf,
    "%llx: expected %x, got %x\n", ofs,
    be32_to_cpu(oh.data_crc),
    be32_to_cpu(crc));
    + err = -EIO;
    goto out_err;
    }
    break;
    @@ -619,6 +620,7 @@ static int __logfs_segment_read(struct inode *inode, void *buf,
    be32_to_cpu(oh.data_crc),
    be32_to_cpu(crc));
    mutex_unlock(&logfs_super(sb)->s_journal_mutex);
    + err = -EIO;
    goto out_err;
    }
    err = logfs_uncompress(compressor_buf, buf, len, block_len);


    \
     
     \ /
      Last update: 2012-08-29 20:21    [W:4.224 / U:0.552 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site