Skip to contentSkip to conversation

fs/f2fs/checkpoint.c:1851 f2fs_start_ckpt_thread() warn: passing zero to 'PTR_ERR'

PATCH New Dan Carpenter 1 participant 1 message Jan 20, 2021 Memory management

lore
Share & tools
lore
#0 lore raw

PATCH 4203/4677 fs/f2fs/checkpoint.c:1851 f2fs_start_ckpt_thread() warn: passing zero to 'PTR_ERR'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git  master
head:   647060f3b592d3c8df0c85dd887557b03e6ea897
commit: b640eda3ba7ee210865f66e06aee62d0fbb9ce51 [4203/4677] f2fs: introduce checkpoint=merge mount option
config: arm-randconfig-m031-20210119 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate

New smatch warnings:
fs/f2fs/checkpoint.c:1851 f2fs_start_ckpt_thread() warn: passing zero to 'PTR_ERR'

Old smatch warnings:
fs/f2fs/f2fs.h:2227 __bitmap_ptr() warn: potential pointer math issue ('&ckpt->sit_nat_version_bitmap + offset' is a 32 bit pointer)

vim +/PTR_ERR +1851 fs/f2fs/checkpoint.c

b640eda3ba7ee210 Daeho Jeong 2021-01-19  1839  int f2fs_start_ckpt_thread(struct f2fs_sb_info *sbi)
b640eda3ba7ee210 Daeho Jeong 2021-01-19  1840  {
b640eda3ba7ee210 Daeho Jeong 2021-01-19  1841  	dev_t dev = sbi->sb->s_bdev->bd_dev;
b640eda3ba7ee210 Daeho Jeong 2021-01-19  1842  	struct ckpt_req_control *cprc = &sbi->cprc_info;
b640eda3ba7ee210 Daeho Jeong 2021-01-19  1843  
b640eda3ba7ee210 Daeho Jeong 2021-01-19  1844  	if (cprc->f2fs_issue_ckpt)
b640eda3ba7ee210 Daeho Jeong 2021-01-19  1845  		return 0;
b640eda3ba7ee210 Daeho Jeong 2021-01-19  1846  
b640eda3ba7ee210 Daeho Jeong 2021-01-19  1847  	cprc->f2fs_issue_ckpt = kthread_run(issue_checkpoint_thread, sbi,
b640eda3ba7ee210 Daeho Jeong 2021-01-19  1848  			"f2fs_ckpt-%u:%u", MAJOR(dev), MINOR(dev));
b640eda3ba7ee210 Daeho Jeong 2021-01-19  1849  	if (IS_ERR(cprc->f2fs_issue_ckpt)) {
b640eda3ba7ee210 Daeho Jeong 2021-01-19  1850  		cprc->f2fs_issue_ckpt = NULL;
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
b640eda3ba7ee210 Daeho Jeong 2021-01-19 @1851  		return PTR_ERR(cprc->f2fs_issue_ckpt);
                                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

returning PTR_ERR(NULL) is success.

b640eda3ba7ee210 Daeho Jeong 2021-01-19  1852  	}
b640eda3ba7ee210 Daeho Jeong 2021-01-19  1853  
b640eda3ba7ee210 Daeho Jeong 2021-01-19  1854  	set_task_ioprio(cprc->f2fs_issue_ckpt, DEFAULT_CHECKPOINT_IOPRIO);
b640eda3ba7ee210 Daeho Jeong 2021-01-19  1855  
b640eda3ba7ee210 Daeho Jeong 2021-01-19  1856  	return 0;
b640eda3ba7ee210 Daeho Jeong 2021-01-19  1857  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org