tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git 
iomap-alloc
head:   f5aa3885760697824600cc6cd94c917a40744e82
commit: 4dcaab0cd2cc2107c4ab770c48d766794decc337 [3/8] gfs2: Move empty inode 
check out of gfs2_unstuff_dinode

smatch warnings:
fs//gfs2/bmap.c:173 __gfs2_unstuff_dinode() error: uninitialized symbol 'error'.

# 
https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git/commit/?id=4dcaab0cd2cc2107c4ab770c48d766794decc337
git remote add gfs2 
https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git
git remote update gfs2
git checkout 4dcaab0cd2cc2107c4ab770c48d766794decc337
vim +/error +173 fs//gfs2/bmap.c

f25ef0c1 Steven Whitehouse   2006-07-26  121  
4dcaab0c Andreas Gruenbacher 2018-08-24  122  static int 
__gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page,
4dcaab0c Andreas Gruenbacher 2018-08-24  123                             struct 
buffer_head *dibh, bool contains_data)
b3b94faa David Teigland      2006-01-16  124  {
4dcaab0c Andreas Gruenbacher 2018-08-24  125    struct buffer_head *bh;
48516ced Steven Whitehouse   2006-10-02  126    struct gfs2_dinode *di;
cd915493 Steven Whitehouse   2006-09-04  127    u64 block = 0;
18ec7d5c Steven Whitehouse   2006-02-08  128    int isdir = gfs2_is_dir(ip);
b3b94faa David Teigland      2006-01-16  129    int error;
                                                ^^^^^^^^^
not initialized to 0 if contains_data is false.

b3b94faa David Teigland      2006-01-16  130  
b3b94faa David Teigland      2006-01-16  131    down_write(&ip->i_rw_mutex);
b3b94faa David Teigland      2006-01-16  132  
4dcaab0c Andreas Gruenbacher 2018-08-24  133    if (contains_data) {
b3b94faa David Teigland      2006-01-16  134            /* Get a free block, 
fill it with the stuffed data,
b3b94faa David Teigland      2006-01-16  135               and write it out to 
disk */
b3b94faa David Teigland      2006-01-16  136  
b45e41d7 Steven Whitehouse   2008-02-06  137            unsigned int n = 1;
6e87ed0f Bob Peterson        2011-11-18  138            error = 
gfs2_alloc_blocks(ip, &block, &n, 0, NULL);
09010978 Steven Whitehouse   2009-05-20  139            if (error)
4dcaab0c Andreas Gruenbacher 2018-08-24  140                    goto out;
18ec7d5c Steven Whitehouse   2006-02-08  141            if (isdir) {
5731be53 Steven Whitehouse   2008-02-01  142                    
gfs2_trans_add_unrevoke(GFS2_SB(&ip->i_inode), block, 1);
61e085a8 Steven Whitehouse   2006-04-24  143                    error = 
gfs2_dir_get_new_buffer(ip, block, &bh);
b3b94faa David Teigland      2006-01-16  144                    if (error)
4dcaab0c Andreas Gruenbacher 2018-08-24  145                            goto 
out;
48516ced Steven Whitehouse   2006-10-02  146                    
gfs2_buffer_copy_tail(bh, sizeof(struct gfs2_meta_header),
b3b94faa David Teigland      2006-01-16  147                                    
      dibh, sizeof(struct gfs2_dinode));
b3b94faa David Teigland      2006-01-16  148                    brelse(bh);
b3b94faa David Teigland      2006-01-16  149            } else {
f25ef0c1 Steven Whitehouse   2006-07-26  150                    error = 
gfs2_unstuffer_page(ip, dibh, block, page);
b3b94faa David Teigland      2006-01-16  151                    if (error)
4dcaab0c Andreas Gruenbacher 2018-08-24  152                            goto 
out;
b3b94faa David Teigland      2006-01-16  153            }
b3b94faa David Teigland      2006-01-16  154    }
b3b94faa David Teigland      2006-01-16  155  
b3b94faa David Teigland      2006-01-16  156    /*  Set up the pointer to the 
new block  */
b3b94faa David Teigland      2006-01-16  157  
350a9b0a Steven Whitehouse   2012-12-14  158    gfs2_trans_add_meta(ip->i_gl, 
dibh);
48516ced Steven Whitehouse   2006-10-02  159    di = (struct gfs2_dinode 
*)dibh->b_data;
b3b94faa David Teigland      2006-01-16  160    gfs2_buffer_clear_tail(dibh, 
sizeof(struct gfs2_dinode));
b3b94faa David Teigland      2006-01-16  161  
4dcaab0c Andreas Gruenbacher 2018-08-24  162    if (contains_data) {
48516ced Steven Whitehouse   2006-10-02  163            *(__be64 *)(di + 1) = 
cpu_to_be64(block);
77658aad Steven Whitehouse   2008-02-12  164            
gfs2_add_inode_blocks(&ip->i_inode, 1);
77658aad Steven Whitehouse   2008-02-12  165            di->di_blocks = 
cpu_to_be64(gfs2_get_inode_blocks(&ip->i_inode));
b3b94faa David Teigland      2006-01-16  166    }
b3b94faa David Teigland      2006-01-16  167  
ecc30c79 Steven Whitehouse   2008-01-28  168    ip->i_height = 1;
48516ced Steven Whitehouse   2006-10-02  169    di->di_height = cpu_to_be16(1);
b3b94faa David Teigland      2006-01-16  170  
b3b94faa David Teigland      2006-01-16  171  out:
b3b94faa David Teigland      2006-01-16  172    up_write(&ip->i_rw_mutex);
b3b94faa David Teigland      2006-01-16 @173    return error;
b3b94faa David Teigland      2006-01-16  174  }
b3b94faa David Teigland      2006-01-16  175  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Reply via email to