lkml.org 
[lkml]   [2006]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] ocfs2: dereference before NULL check in ocfs2_direct_IO_get_blocks()
    'bh_result' & 'inode' are explicitly checked against NULL so they
    shouldn't be dereferenced prior to that.

    Coverity ID: 1273, 1274.

    Signed-off-by: Florin Malita <fmalita@gmail.com>
    ---

    fs/ocfs2/aops.c | 3 ++-
    1 file changed, 2 insertions(+), 1 deletion(-)

    diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
    index 47152bf..16d6478 100644
    --- a/fs/ocfs2/aops.c
    +++ b/fs/ocfs2/aops.c
    @@ -559,13 +559,14 @@ static int ocfs2_direct_IO_get_blocks(st
    u64 p_blkno;
    int contig_blocks;
    unsigned char blocksize_bits;
    - unsigned long max_blocks = bh_result->b_size >> inode->i_blkbits;
    + unsigned long max_blocks;

    if (!inode || !bh_result) {
    mlog(ML_ERROR, "inode or bh_result is null\n");
    return -EIO;
    }

    + max_blocks = bh_result->b_size >> inode->i_blkbits;
    blocksize_bits = inode->i_sb->s_blocksize_bits;

    /* This function won't even be called if the request isn't all


    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-06-03 17:32    [W:0.029 / U:60.116 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site