lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202105032112.SJqOaXpO-lkp@intel.com>
Date:   Mon, 3 May 2021 16:27:03 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Vivek Goyal <vgoyal@...hat.com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org, Miklos Szeredi <mszeredi@...hat.com>,
        Stefan Hajnoczi <stefanha@...hat.com>,
        "Dr. David Alan Gilbert" <dgilbert@...hat.com>,
        Liu Bo <bo.liu@...ux.alibaba.com>,
        Peng Tao <tao.peng@...ux.alibaba.com>
Subject: [kbuild] fs/fuse/dax.c:113 fuse_setup_one_mapping() warn: should
 'start_idx << 21' be a 64 bit type?

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git  master
head:   9ccce092fc64d19504fa54de4fd659e279cc92e7
commit: c2d0ad00d948de73c78f05d2b3e5bdfa605035cc virtiofs: implement dax read/write operations
config: i386-randconfig-m031-20210503 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

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

New smatch warnings:
fs/fuse/dax.c:113 fuse_setup_one_mapping() warn: should 'start_idx << 21' be a 64 bit type?

Old smatch warnings:
fs/fuse/dax.c:197 dmap_removemapping_list() error: uninitialized symbol 'ret'.

vim +113 fs/fuse/dax.c

c2d0ad00d948de Vivek Goyal 2020-08-19  105  static int fuse_setup_one_mapping(struct inode *inode, unsigned long start_idx,
c2d0ad00d948de Vivek Goyal 2020-08-19  106  				  struct fuse_dax_mapping *dmap, bool writable,
c2d0ad00d948de Vivek Goyal 2020-08-19  107  				  bool upgrade)
c2d0ad00d948de Vivek Goyal 2020-08-19  108  {
c2d0ad00d948de Vivek Goyal 2020-08-19  109  	struct fuse_conn *fc = get_fuse_conn(inode);
c2d0ad00d948de Vivek Goyal 2020-08-19  110  	struct fuse_conn_dax *fcd = fc->dax;
c2d0ad00d948de Vivek Goyal 2020-08-19  111  	struct fuse_inode *fi = get_fuse_inode(inode);
c2d0ad00d948de Vivek Goyal 2020-08-19  112  	struct fuse_setupmapping_in inarg;
c2d0ad00d948de Vivek Goyal 2020-08-19 @113  	loff_t offset = start_idx << FUSE_DAX_SHIFT;

This is only an issue on 32 bit systems but "offset" is a 64bit and
"start_idx" is ulong.

c2d0ad00d948de Vivek Goyal 2020-08-19  114  	FUSE_ARGS(args);
c2d0ad00d948de Vivek Goyal 2020-08-19  115  	ssize_t err;
c2d0ad00d948de Vivek Goyal 2020-08-19  116  
c2d0ad00d948de Vivek Goyal 2020-08-19  117  	WARN_ON(fcd->nr_free_ranges < 0);
c2d0ad00d948de Vivek Goyal 2020-08-19  118  
c2d0ad00d948de Vivek Goyal 2020-08-19  119  	/* Ask fuse daemon to setup mapping */
c2d0ad00d948de Vivek Goyal 2020-08-19  120  	memset(&inarg, 0, sizeof(inarg));
c2d0ad00d948de Vivek Goyal 2020-08-19  121  	inarg.foffset = offset;
c2d0ad00d948de Vivek Goyal 2020-08-19  122  	inarg.fh = -1;
c2d0ad00d948de Vivek Goyal 2020-08-19  123  	inarg.moffset = dmap->window_offset;
c2d0ad00d948de Vivek Goyal 2020-08-19  124  	inarg.len = FUSE_DAX_SZ;
c2d0ad00d948de Vivek Goyal 2020-08-19  125  	inarg.flags |= FUSE_SETUPMAPPING_FLAG_READ;
c2d0ad00d948de Vivek Goyal 2020-08-19  126  	if (writable)
c2d0ad00d948de Vivek Goyal 2020-08-19  127  		inarg.flags |= FUSE_SETUPMAPPING_FLAG_WRITE;
c2d0ad00d948de Vivek Goyal 2020-08-19  128  	args.opcode = FUSE_SETUPMAPPING;
c2d0ad00d948de Vivek Goyal 2020-08-19  129  	args.nodeid = fi->nodeid;
c2d0ad00d948de Vivek Goyal 2020-08-19  130  	args.in_numargs = 1;
c2d0ad00d948de Vivek Goyal 2020-08-19  131  	args.in_args[0].size = sizeof(inarg);
c2d0ad00d948de Vivek Goyal 2020-08-19  132  	args.in_args[0].value = &inarg;
c2d0ad00d948de Vivek Goyal 2020-08-19  133  	err = fuse_simple_request(fc, &args);
c2d0ad00d948de Vivek Goyal 2020-08-19  134  	if (err < 0)
c2d0ad00d948de Vivek Goyal 2020-08-19  135  		return err;
c2d0ad00d948de Vivek Goyal 2020-08-19  136  	dmap->writable = writable;
c2d0ad00d948de Vivek Goyal 2020-08-19  137  	if (!upgrade) {
c2d0ad00d948de Vivek Goyal 2020-08-19  138  		dmap->itn.start = dmap->itn.last = start_idx;
c2d0ad00d948de Vivek Goyal 2020-08-19  139  		/* Protected by fi->dax->sem */
c2d0ad00d948de Vivek Goyal 2020-08-19  140  		interval_tree_insert(&dmap->itn, &fi->dax->tree);
c2d0ad00d948de Vivek Goyal 2020-08-19  141  		fi->dax->nr++;
c2d0ad00d948de Vivek Goyal 2020-08-19  142  	}
c2d0ad00d948de Vivek Goyal 2020-08-19  143  	return 0;
c2d0ad00d948de Vivek Goyal 2020-08-19  144  }

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

_______________________________________________
kbuild mailing list -- kbuild@...ts.01.org
To unsubscribe send an email to kbuild-leave@...ts.01.org

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ