From: Julia Lawall <[email protected]> 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 <[email protected]> --- 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); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

