[staging:staging-testing 546/628] drivers/staging/erofs/namei.c:195:8-14: WARNING: PTR_ERR_OR_ZERO can be used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Gao,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-testing
head:   b9f13084580c9032ba7c505da2c6c075f176472a
commit: fd68c6a20fcfac78b70465ec2e858403dc200056 [546/628] staging: erofs: update Kconfig and Makefile


coccinelle warnings: (new ones prefixed by >>)

>> drivers/staging/erofs/namei.c:195:8-14: WARNING: PTR_ERR_OR_ZERO can be used

vim +195 drivers/staging/erofs/namei.c

d72d1ce6 Gao Xiang 2018-07-26  161  
d72d1ce6 Gao Xiang 2018-07-26  162  int erofs_namei(struct inode *dir,
d72d1ce6 Gao Xiang 2018-07-26  163  	struct qstr *name,
d72d1ce6 Gao Xiang 2018-07-26  164  	erofs_nid_t *nid, unsigned *d_type)
d72d1ce6 Gao Xiang 2018-07-26  165  {
d72d1ce6 Gao Xiang 2018-07-26  166  	int diff;
d72d1ce6 Gao Xiang 2018-07-26  167  	struct page *page;
d72d1ce6 Gao Xiang 2018-07-26  168  	u8 *data;
d72d1ce6 Gao Xiang 2018-07-26  169  	struct erofs_dirent *de;
d72d1ce6 Gao Xiang 2018-07-26  170  
d72d1ce6 Gao Xiang 2018-07-26  171  	if (unlikely(!dir->i_size))
d72d1ce6 Gao Xiang 2018-07-26  172  		return -ENOENT;
d72d1ce6 Gao Xiang 2018-07-26  173  
d72d1ce6 Gao Xiang 2018-07-26  174  	diff = 1;
d72d1ce6 Gao Xiang 2018-07-26  175  	page = find_target_block_classic(dir, name, &diff);
d72d1ce6 Gao Xiang 2018-07-26  176  
d72d1ce6 Gao Xiang 2018-07-26  177  	if (unlikely(IS_ERR(page)))
d72d1ce6 Gao Xiang 2018-07-26  178  		return PTR_ERR(page);
d72d1ce6 Gao Xiang 2018-07-26  179  
d72d1ce6 Gao Xiang 2018-07-26  180  	data = kmap_atomic(page);
d72d1ce6 Gao Xiang 2018-07-26  181  	/* the target page has been mapped */
d72d1ce6 Gao Xiang 2018-07-26  182  	de = likely(diff) ?
d72d1ce6 Gao Xiang 2018-07-26  183  		/* since the rest of the last page is 0 */
d72d1ce6 Gao Xiang 2018-07-26  184  		find_target_dirent(name, data, EROFS_BLKSIZ) :
d72d1ce6 Gao Xiang 2018-07-26  185  		(struct erofs_dirent *)data;
d72d1ce6 Gao Xiang 2018-07-26  186  
d72d1ce6 Gao Xiang 2018-07-26  187  	if (likely(!IS_ERR(de))) {
d72d1ce6 Gao Xiang 2018-07-26  188  		*nid = le64_to_cpu(de->nid);
d72d1ce6 Gao Xiang 2018-07-26  189  		*d_type = de->file_type;
d72d1ce6 Gao Xiang 2018-07-26  190  	}
d72d1ce6 Gao Xiang 2018-07-26  191  
d72d1ce6 Gao Xiang 2018-07-26  192  	kunmap_atomic(data);
d72d1ce6 Gao Xiang 2018-07-26  193  	put_page(page);
d72d1ce6 Gao Xiang 2018-07-26  194  
d72d1ce6 Gao Xiang 2018-07-26 @195  	return IS_ERR(de) ? PTR_ERR(de) : 0;
d72d1ce6 Gao Xiang 2018-07-26  196  }
d72d1ce6 Gao Xiang 2018-07-26  197  

:::::: The code at line 195 was first introduced by commit
:::::: d72d1ce601743deed322ad5b74e960a2fd8ff205 staging: erofs: add namei functions

:::::: TO: Gao Xiang <gaoxiang25@xxxxxxxxxx>
:::::: CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux