Skip to contentSkip to conversation

fs/gfs2/trans.c:176 databuf_lo_add() error: we previously assumed 'tr' could be null (see line 168)

PATCH New Dan Carpenter 2 participants 2 messages Jan 4, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 5/9 fs/gfs2/trans.c:176 databuf_lo_add() error: we previously assumed 'tr' could be null (see line 168)

[ It could be that gfs2_is_jdata(ip) implies tr is non-NULL, I'm not
familiar enough with the subsystem to say ].

Hi Steven,

FYI, there are new smatch warnings show up in

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw.git master
head:   e525d6d182bb81599fc5da017fcd23b21623630e
commit: ef9151d84b94affb7371fbc9dd7074d1c85d6fc3 [5/9] GFS2: Copy gfs2_trans_add_bh into new data/meta functions

+ fs/gfs2/trans.c:176 databuf_lo_add() error: we previously assumed 'tr' could be null (see line 168)

git remote add gfs2 git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw.git
git remote update gfs2
git checkout ef9151d84b94affb7371fbc9dd7074d1c85d6fc3
vim +/tr +176 fs/gfs2/trans.c

ef9151d8 Steven Whitehouse 2012-12-14  162  static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
ef9151d8 Steven Whitehouse 2012-12-14  163  {
ef9151d8 Steven Whitehouse 2012-12-14  164  	struct gfs2_trans *tr = current->journal_info;
ef9151d8 Steven Whitehouse 2012-12-14  165  	struct address_space *mapping = bd->bd_bh->b_page->mapping;
ef9151d8 Steven Whitehouse 2012-12-14  166  	struct gfs2_inode *ip = GFS2_I(mapping->host);
ef9151d8 Steven Whitehouse 2012-12-14  167  
ef9151d8 Steven Whitehouse 2012-12-14 @168  	if (tr)
ef9151d8 Steven Whitehouse 2012-12-14  169  		tr->tr_touched = 1;
ef9151d8 Steven Whitehouse 2012-12-14  170  	if (!list_empty(&bd->bd_list))
ef9151d8 Steven Whitehouse 2012-12-14  171  		return;
ef9151d8 Steven Whitehouse 2012-12-14  172  	set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags);
ef9151d8 Steven Whitehouse 2012-12-14  173  	set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags);
ef9151d8 Steven Whitehouse 2012-12-14  174  	if (gfs2_is_jdata(ip)) {
ef9151d8 Steven Whitehouse 2012-12-14  175  		gfs2_pin(sdp, bd->bd_bh);
ef9151d8 Steven Whitehouse 2012-12-14 @176  		tr->tr_num_databuf_new++;
ef9151d8 Steven Whitehouse 2012-12-14  177  		sdp->sd_log_num_databuf++;
ef9151d8 Steven Whitehouse 2012-12-14  178  		list_add_tail(&bd->bd_list, &sdp->sd_log_le_databuf);
ef9151d8 Steven Whitehouse 2012-12-14  179  	} else {

---
0-DAY kernel build testing backend Open Source Technology Center
Fengguang Wu, Yuanhan Liu Intel Corporation

#1 lore raw

PATCH 5/9 fs/gfs2/trans.c:176 databuf_lo_add() error: we previously assumed 'tr' could be null (see line 168)

Hi,

Quoted 3 lines · Dan Carpenter

[ It could be that gfs2_is_jdata(ip) implies tr is non-NULL, I'm not
familiar enough with the subsystem to say ].

Yes, it does. The code should not have changed, I just reorganised it, so I guess that was enough to get this warning flagged up,

Steve.

Quoted 37 lines

Hi Steven,

FYI, there are new smatch warnings show up in

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw.git master
head:   e525d6d182bb81599fc5da017fcd23b21623630e
commit: ef9151d84b94affb7371fbc9dd7074d1c85d6fc3 [5/9] GFS2: Copy gfs2_trans_add_bh into new data/meta functions

+ fs/gfs2/trans.c:176 databuf_lo_add() error: we previously assumed 'tr' could be null (see line 168)

git remote add gfs2 git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw.git
git remote update gfs2
git checkout ef9151d84b94affb7371fbc9dd7074d1c85d6fc3
vim +/tr +176 fs/gfs2/trans.c

ef9151d8 Steven Whitehouse 2012-12-14  162  static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
ef9151d8 Steven Whitehouse 2012-12-14  163  {
ef9151d8 Steven Whitehouse 2012-12-14  164  	struct gfs2_trans *tr = current->journal_info;
ef9151d8 Steven Whitehouse 2012-12-14  165  	struct address_space *mapping = bd->bd_bh->b_page->mapping;
ef9151d8 Steven Whitehouse 2012-12-14  166  	struct gfs2_inode *ip = GFS2_I(mapping->host);
ef9151d8 Steven Whitehouse 2012-12-14  167  
ef9151d8 Steven Whitehouse 2012-12-14 @168  	if (tr)
ef9151d8 Steven Whitehouse 2012-12-14  169  		tr->tr_touched = 1;
ef9151d8 Steven Whitehouse 2012-12-14  170  	if (!list_empty(&bd->bd_list))
ef9151d8 Steven Whitehouse 2012-12-14  171  		return;
ef9151d8 Steven Whitehouse 2012-12-14  172  	set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags);
ef9151d8 Steven Whitehouse 2012-12-14  173  	set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags);
ef9151d8 Steven Whitehouse 2012-12-14  174  	if (gfs2_is_jdata(ip)) {
ef9151d8 Steven Whitehouse 2012-12-14  175  		gfs2_pin(sdp, bd->bd_bh);
ef9151d8 Steven Whitehouse 2012-12-14 @176  		tr->tr_num_databuf_new++;
ef9151d8 Steven Whitehouse 2012-12-14  177  		sdp->sd_log_num_databuf++;
ef9151d8 Steven Whitehouse 2012-12-14  178  		list_add_tail(&bd->bd_list, &sdp->sd_log_le_databuf);
ef9151d8 Steven Whitehouse 2012-12-14  179  	} else {

---
0-DAY kernel build testing backend Open Source Technology Center
Fengguang Wu, Yuanhan Liu Intel Corporation