All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH v2 2/2] f2fs: add F2FS_IOC_SET_COMPRESS_OPTION ioctl
Date: Fri, 23 Oct 2020 15:00:36 +0300	[thread overview]
Message-ID: <20201023120036.GY1042@kadam> (raw)
In-Reply-To: <20201022035848.976286-2-daeho43@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4417 bytes --]

Hi Daeho,

url:    https://github.com/0day-ci/linux/commits/Daeho-Jeong/f2fs-add-F2FS_IOC_GET_COMPRESS_OPTION-ioctl/20201022-115947
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
config: x86_64-randconfig-m001-20201022 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
fs/f2fs/file.c:4011 f2fs_ioc_set_compress_option() error: uninitialized symbol 'ret'.

Old smatch warnings:
fs/f2fs/f2fs.h:2127 dec_valid_block_count() warn: should 'count << 3' be a 64 bit type?
fs/f2fs/file.c:2525 f2fs_ioc_gc_range() warn: inconsistent returns 'sbi->gc_lock'.
fs/f2fs/file.c:2941 f2fs_ioc_flush_device() warn: potential spectre issue 'sbi->devs' [w] (local cap)
fs/f2fs/file.c:2966 f2fs_ioc_flush_device() warn: inconsistent returns 'sbi->gc_lock'.
fs/f2fs/file.c:3305 f2fs_precache_extents() error: uninitialized symbol 'err'.

vim +/ret +4011 fs/f2fs/file.c

d869d11ac39edb Daeho Jeong 2020-10-22  3969  static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg)
d869d11ac39edb Daeho Jeong 2020-10-22  3970  {
d869d11ac39edb Daeho Jeong 2020-10-22  3971  	struct inode *inode = file_inode(filp);
d869d11ac39edb Daeho Jeong 2020-10-22  3972  	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
d869d11ac39edb Daeho Jeong 2020-10-22  3973  	struct f2fs_comp_option option;
d869d11ac39edb Daeho Jeong 2020-10-22  3974  	int ret;
d869d11ac39edb Daeho Jeong 2020-10-22  3975  
d869d11ac39edb Daeho Jeong 2020-10-22  3976  	if (!f2fs_sb_has_compression(sbi))
d869d11ac39edb Daeho Jeong 2020-10-22  3977  		return -EOPNOTSUPP;
d869d11ac39edb Daeho Jeong 2020-10-22  3978  
d869d11ac39edb Daeho Jeong 2020-10-22  3979  	if (!f2fs_compressed_file(inode))
d869d11ac39edb Daeho Jeong 2020-10-22  3980  		return -EINVAL;
d869d11ac39edb Daeho Jeong 2020-10-22  3981  
d869d11ac39edb Daeho Jeong 2020-10-22  3982  	if (!(filp->f_mode & FMODE_WRITE))
d869d11ac39edb Daeho Jeong 2020-10-22  3983  		return -EBADF;
d869d11ac39edb Daeho Jeong 2020-10-22  3984  
d869d11ac39edb Daeho Jeong 2020-10-22  3985  	if (copy_from_user(&option, (struct f2fs_comp_option __user *)arg,
d869d11ac39edb Daeho Jeong 2020-10-22  3986  				sizeof(option)))
d869d11ac39edb Daeho Jeong 2020-10-22  3987  		return -EFAULT;
d869d11ac39edb Daeho Jeong 2020-10-22  3988  
d869d11ac39edb Daeho Jeong 2020-10-22  3989  	if (option.log_cluster_size < MIN_COMPRESS_LOG_SIZE ||
d869d11ac39edb Daeho Jeong 2020-10-22  3990  			option.log_cluster_size > MAX_COMPRESS_LOG_SIZE ||
d869d11ac39edb Daeho Jeong 2020-10-22  3991  			!f2fs_is_compress_algorithm_ready(option.algorithm))
d869d11ac39edb Daeho Jeong 2020-10-22  3992  		return -EINVAL;
d869d11ac39edb Daeho Jeong 2020-10-22  3993  
d869d11ac39edb Daeho Jeong 2020-10-22  3994  	file_start_write(filp);
d869d11ac39edb Daeho Jeong 2020-10-22  3995  	inode_lock(inode);
d869d11ac39edb Daeho Jeong 2020-10-22  3996  
d869d11ac39edb Daeho Jeong 2020-10-22  3997  	if (f2fs_is_mmap_file(inode) ||
d869d11ac39edb Daeho Jeong 2020-10-22  3998  			get_dirty_pages(inode) || inode->i_size) {
d869d11ac39edb Daeho Jeong 2020-10-22  3999  		ret = -EINVAL;
d869d11ac39edb Daeho Jeong 2020-10-22  4000  		goto out;
d869d11ac39edb Daeho Jeong 2020-10-22  4001  	}
d869d11ac39edb Daeho Jeong 2020-10-22  4002  
d869d11ac39edb Daeho Jeong 2020-10-22  4003  	F2FS_I(inode)->i_compress_algorithm = option.algorithm;
d869d11ac39edb Daeho Jeong 2020-10-22  4004  	F2FS_I(inode)->i_log_cluster_size = option.log_cluster_size;
d869d11ac39edb Daeho Jeong 2020-10-22  4005  	F2FS_I(inode)->i_cluster_size = 1 << option.log_cluster_size;
d869d11ac39edb Daeho Jeong 2020-10-22  4006  	f2fs_mark_inode_dirty_sync(inode, true);


"ret" is uninitialized on the success path.

d869d11ac39edb Daeho Jeong 2020-10-22  4007  out:
d869d11ac39edb Daeho Jeong 2020-10-22  4008  	inode_unlock(inode);
d869d11ac39edb Daeho Jeong 2020-10-22  4009  	file_end_write(filp);
d869d11ac39edb Daeho Jeong 2020-10-22  4010  
d869d11ac39edb Daeho Jeong 2020-10-22 @4011  	return ret;
d869d11ac39edb Daeho Jeong 2020-10-22  4012  }

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36000 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH v2 2/2] f2fs: add F2FS_IOC_SET_COMPRESS_OPTION ioctl
Date: Fri, 23 Oct 2020 15:00:36 +0300	[thread overview]
Message-ID: <20201023120036.GY1042@kadam> (raw)
In-Reply-To: <20201022035848.976286-2-daeho43@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4417 bytes --]

Hi Daeho,

url:    https://github.com/0day-ci/linux/commits/Daeho-Jeong/f2fs-add-F2FS_IOC_GET_COMPRESS_OPTION-ioctl/20201022-115947
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
config: x86_64-randconfig-m001-20201022 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
fs/f2fs/file.c:4011 f2fs_ioc_set_compress_option() error: uninitialized symbol 'ret'.

Old smatch warnings:
fs/f2fs/f2fs.h:2127 dec_valid_block_count() warn: should 'count << 3' be a 64 bit type?
fs/f2fs/file.c:2525 f2fs_ioc_gc_range() warn: inconsistent returns 'sbi->gc_lock'.
fs/f2fs/file.c:2941 f2fs_ioc_flush_device() warn: potential spectre issue 'sbi->devs' [w] (local cap)
fs/f2fs/file.c:2966 f2fs_ioc_flush_device() warn: inconsistent returns 'sbi->gc_lock'.
fs/f2fs/file.c:3305 f2fs_precache_extents() error: uninitialized symbol 'err'.

vim +/ret +4011 fs/f2fs/file.c

d869d11ac39edb Daeho Jeong 2020-10-22  3969  static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg)
d869d11ac39edb Daeho Jeong 2020-10-22  3970  {
d869d11ac39edb Daeho Jeong 2020-10-22  3971  	struct inode *inode = file_inode(filp);
d869d11ac39edb Daeho Jeong 2020-10-22  3972  	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
d869d11ac39edb Daeho Jeong 2020-10-22  3973  	struct f2fs_comp_option option;
d869d11ac39edb Daeho Jeong 2020-10-22  3974  	int ret;
d869d11ac39edb Daeho Jeong 2020-10-22  3975  
d869d11ac39edb Daeho Jeong 2020-10-22  3976  	if (!f2fs_sb_has_compression(sbi))
d869d11ac39edb Daeho Jeong 2020-10-22  3977  		return -EOPNOTSUPP;
d869d11ac39edb Daeho Jeong 2020-10-22  3978  
d869d11ac39edb Daeho Jeong 2020-10-22  3979  	if (!f2fs_compressed_file(inode))
d869d11ac39edb Daeho Jeong 2020-10-22  3980  		return -EINVAL;
d869d11ac39edb Daeho Jeong 2020-10-22  3981  
d869d11ac39edb Daeho Jeong 2020-10-22  3982  	if (!(filp->f_mode & FMODE_WRITE))
d869d11ac39edb Daeho Jeong 2020-10-22  3983  		return -EBADF;
d869d11ac39edb Daeho Jeong 2020-10-22  3984  
d869d11ac39edb Daeho Jeong 2020-10-22  3985  	if (copy_from_user(&option, (struct f2fs_comp_option __user *)arg,
d869d11ac39edb Daeho Jeong 2020-10-22  3986  				sizeof(option)))
d869d11ac39edb Daeho Jeong 2020-10-22  3987  		return -EFAULT;
d869d11ac39edb Daeho Jeong 2020-10-22  3988  
d869d11ac39edb Daeho Jeong 2020-10-22  3989  	if (option.log_cluster_size < MIN_COMPRESS_LOG_SIZE ||
d869d11ac39edb Daeho Jeong 2020-10-22  3990  			option.log_cluster_size > MAX_COMPRESS_LOG_SIZE ||
d869d11ac39edb Daeho Jeong 2020-10-22  3991  			!f2fs_is_compress_algorithm_ready(option.algorithm))
d869d11ac39edb Daeho Jeong 2020-10-22  3992  		return -EINVAL;
d869d11ac39edb Daeho Jeong 2020-10-22  3993  
d869d11ac39edb Daeho Jeong 2020-10-22  3994  	file_start_write(filp);
d869d11ac39edb Daeho Jeong 2020-10-22  3995  	inode_lock(inode);
d869d11ac39edb Daeho Jeong 2020-10-22  3996  
d869d11ac39edb Daeho Jeong 2020-10-22  3997  	if (f2fs_is_mmap_file(inode) ||
d869d11ac39edb Daeho Jeong 2020-10-22  3998  			get_dirty_pages(inode) || inode->i_size) {
d869d11ac39edb Daeho Jeong 2020-10-22  3999  		ret = -EINVAL;
d869d11ac39edb Daeho Jeong 2020-10-22  4000  		goto out;
d869d11ac39edb Daeho Jeong 2020-10-22  4001  	}
d869d11ac39edb Daeho Jeong 2020-10-22  4002  
d869d11ac39edb Daeho Jeong 2020-10-22  4003  	F2FS_I(inode)->i_compress_algorithm = option.algorithm;
d869d11ac39edb Daeho Jeong 2020-10-22  4004  	F2FS_I(inode)->i_log_cluster_size = option.log_cluster_size;
d869d11ac39edb Daeho Jeong 2020-10-22  4005  	F2FS_I(inode)->i_cluster_size = 1 << option.log_cluster_size;
d869d11ac39edb Daeho Jeong 2020-10-22  4006  	f2fs_mark_inode_dirty_sync(inode, true);


"ret" is uninitialized on the success path.

d869d11ac39edb Daeho Jeong 2020-10-22  4007  out:
d869d11ac39edb Daeho Jeong 2020-10-22  4008  	inode_unlock(inode);
d869d11ac39edb Daeho Jeong 2020-10-22  4009  	file_end_write(filp);
d869d11ac39edb Daeho Jeong 2020-10-22  4010  
d869d11ac39edb Daeho Jeong 2020-10-22 @4011  	return ret;
d869d11ac39edb Daeho Jeong 2020-10-22  4012  }

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36000 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Daeho Jeong <daeho43@gmail.com>,
	linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	Daeho Jeong <daehojeong@google.com>
Subject: Re: [PATCH v2 2/2] f2fs: add F2FS_IOC_SET_COMPRESS_OPTION ioctl
Date: Fri, 23 Oct 2020 15:00:36 +0300	[thread overview]
Message-ID: <20201023120036.GY1042@kadam> (raw)
In-Reply-To: <20201022035848.976286-2-daeho43@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4342 bytes --]

Hi Daeho,

url:    https://github.com/0day-ci/linux/commits/Daeho-Jeong/f2fs-add-F2FS_IOC_GET_COMPRESS_OPTION-ioctl/20201022-115947
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
config: x86_64-randconfig-m001-20201022 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
fs/f2fs/file.c:4011 f2fs_ioc_set_compress_option() error: uninitialized symbol 'ret'.

Old smatch warnings:
fs/f2fs/f2fs.h:2127 dec_valid_block_count() warn: should 'count << 3' be a 64 bit type?
fs/f2fs/file.c:2525 f2fs_ioc_gc_range() warn: inconsistent returns 'sbi->gc_lock'.
fs/f2fs/file.c:2941 f2fs_ioc_flush_device() warn: potential spectre issue 'sbi->devs' [w] (local cap)
fs/f2fs/file.c:2966 f2fs_ioc_flush_device() warn: inconsistent returns 'sbi->gc_lock'.
fs/f2fs/file.c:3305 f2fs_precache_extents() error: uninitialized symbol 'err'.

vim +/ret +4011 fs/f2fs/file.c

d869d11ac39edb Daeho Jeong 2020-10-22  3969  static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg)
d869d11ac39edb Daeho Jeong 2020-10-22  3970  {
d869d11ac39edb Daeho Jeong 2020-10-22  3971  	struct inode *inode = file_inode(filp);
d869d11ac39edb Daeho Jeong 2020-10-22  3972  	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
d869d11ac39edb Daeho Jeong 2020-10-22  3973  	struct f2fs_comp_option option;
d869d11ac39edb Daeho Jeong 2020-10-22  3974  	int ret;
d869d11ac39edb Daeho Jeong 2020-10-22  3975  
d869d11ac39edb Daeho Jeong 2020-10-22  3976  	if (!f2fs_sb_has_compression(sbi))
d869d11ac39edb Daeho Jeong 2020-10-22  3977  		return -EOPNOTSUPP;
d869d11ac39edb Daeho Jeong 2020-10-22  3978  
d869d11ac39edb Daeho Jeong 2020-10-22  3979  	if (!f2fs_compressed_file(inode))
d869d11ac39edb Daeho Jeong 2020-10-22  3980  		return -EINVAL;
d869d11ac39edb Daeho Jeong 2020-10-22  3981  
d869d11ac39edb Daeho Jeong 2020-10-22  3982  	if (!(filp->f_mode & FMODE_WRITE))
d869d11ac39edb Daeho Jeong 2020-10-22  3983  		return -EBADF;
d869d11ac39edb Daeho Jeong 2020-10-22  3984  
d869d11ac39edb Daeho Jeong 2020-10-22  3985  	if (copy_from_user(&option, (struct f2fs_comp_option __user *)arg,
d869d11ac39edb Daeho Jeong 2020-10-22  3986  				sizeof(option)))
d869d11ac39edb Daeho Jeong 2020-10-22  3987  		return -EFAULT;
d869d11ac39edb Daeho Jeong 2020-10-22  3988  
d869d11ac39edb Daeho Jeong 2020-10-22  3989  	if (option.log_cluster_size < MIN_COMPRESS_LOG_SIZE ||
d869d11ac39edb Daeho Jeong 2020-10-22  3990  			option.log_cluster_size > MAX_COMPRESS_LOG_SIZE ||
d869d11ac39edb Daeho Jeong 2020-10-22  3991  			!f2fs_is_compress_algorithm_ready(option.algorithm))
d869d11ac39edb Daeho Jeong 2020-10-22  3992  		return -EINVAL;
d869d11ac39edb Daeho Jeong 2020-10-22  3993  
d869d11ac39edb Daeho Jeong 2020-10-22  3994  	file_start_write(filp);
d869d11ac39edb Daeho Jeong 2020-10-22  3995  	inode_lock(inode);
d869d11ac39edb Daeho Jeong 2020-10-22  3996  
d869d11ac39edb Daeho Jeong 2020-10-22  3997  	if (f2fs_is_mmap_file(inode) ||
d869d11ac39edb Daeho Jeong 2020-10-22  3998  			get_dirty_pages(inode) || inode->i_size) {
d869d11ac39edb Daeho Jeong 2020-10-22  3999  		ret = -EINVAL;
d869d11ac39edb Daeho Jeong 2020-10-22  4000  		goto out;
d869d11ac39edb Daeho Jeong 2020-10-22  4001  	}
d869d11ac39edb Daeho Jeong 2020-10-22  4002  
d869d11ac39edb Daeho Jeong 2020-10-22  4003  	F2FS_I(inode)->i_compress_algorithm = option.algorithm;
d869d11ac39edb Daeho Jeong 2020-10-22  4004  	F2FS_I(inode)->i_log_cluster_size = option.log_cluster_size;
d869d11ac39edb Daeho Jeong 2020-10-22  4005  	F2FS_I(inode)->i_cluster_size = 1 << option.log_cluster_size;
d869d11ac39edb Daeho Jeong 2020-10-22  4006  	f2fs_mark_inode_dirty_sync(inode, true);


"ret" is uninitialized on the success path.

d869d11ac39edb Daeho Jeong 2020-10-22  4007  out:
d869d11ac39edb Daeho Jeong 2020-10-22  4008  	inode_unlock(inode);
d869d11ac39edb Daeho Jeong 2020-10-22  4009  	file_end_write(filp);
d869d11ac39edb Daeho Jeong 2020-10-22  4010  
d869d11ac39edb Daeho Jeong 2020-10-22 @4011  	return ret;
d869d11ac39edb Daeho Jeong 2020-10-22  4012  }

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 36000 bytes --]

  parent reply	other threads:[~2020-10-23 12:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-22  3:58 [f2fs-dev] [PATCH v2 1/2] f2fs: add F2FS_IOC_GET_COMPRESS_OPTION ioctl Daeho Jeong
2020-10-22  3:58 ` Daeho Jeong
2020-10-22  3:58 ` [f2fs-dev] [PATCH v2 2/2] f2fs: add F2FS_IOC_SET_COMPRESS_OPTION ioctl Daeho Jeong
2020-10-22  3:58   ` Daeho Jeong
2020-10-22  4:26   ` [f2fs-dev] " Eric Biggers
2020-10-22  4:26     ` Eric Biggers
2020-10-22  4:36     ` Daeho Jeong
2020-10-22  4:36       ` Daeho Jeong
2020-10-22  6:50   ` kernel test robot
2020-10-22  6:50     ` kernel test robot
2020-10-22 10:14   ` kernel test robot
2020-10-22 10:14     ` kernel test robot
2020-10-23 12:00   ` Dan Carpenter [this message]
2020-10-23 12:00     ` Dan Carpenter
2020-10-23 12:00     ` Dan Carpenter
2020-10-23 12:03     ` [f2fs-dev] " Daeho Jeong
2020-10-23 12:03       ` Daeho Jeong
2020-10-22  4:22 ` [f2fs-dev] [PATCH v2 1/2] f2fs: add F2FS_IOC_GET_COMPRESS_OPTION ioctl Eric Biggers
2020-10-22  4:22   ` Eric Biggers
2020-10-22  4:30   ` Daeho Jeong
2020-10-22  4:30     ` Daeho Jeong
  -- strict thread matches above, loose matches on Subject: below --
2020-10-22 20:27 [PATCH v2 2/2] f2fs: add F2FS_IOC_SET_COMPRESS_OPTION ioctl kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201023120036.GY1042@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.