tree:
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
head: 18956295fea61e6a08a15d829b06e744830ae236
commit: 8b69aff891d42d194b3587c9b8ed32d896eef277 [107/140] scsi: sg: Rework mmap support
config: sparc64-randconfig-s031-20210309 (attached as .config)
compiler: sparc64-linux-gcc (GCC) 9.3.0
reproduce:
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-262-g5e674421-dirty
#
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git/commit/?id=8...
git remote add mkp-scsi
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git
git fetch --no-tags mkp-scsi for-next
git checkout 8b69aff891d42d194b3587c9b8ed32d896eef277
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=sparc64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
"sparse warnings: (new ones prefixed by >>)"
drivers/scsi/sg.c: note: in included file (through include/uapi/scsi/sg.h,
include/scsi/sg.h):
/opt/cross/gcc-9.3.0-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/9.3.0/include/stddef.h:406:9:
sparse: sparse: preprocessor token offsetof redefined
drivers/scsi/sg.c: note: in included file (through include/uapi/linux/posix_types.h,
include/uapi/linux/types.h, include/linux/types.h, ...):
include/linux/stddef.h:17:9: sparse: this was the original definition
> drivers/scsi/sg.c:2270:19: sparse: sparse: incorrect type in
initializer (different base types) @@ expected int res @@ got restricted
vm_fault_t @@
drivers/scsi/sg.c:2270:19: sparse: expected int res
drivers/scsi/sg.c:2270:19: sparse: got restricted vm_fault_t
> drivers/scsi/sg.c:2319:16: sparse: sparse: incorrect type in
return expression (different base types) @@ expected restricted vm_fault_t @@ got
int [assigned] res @@
drivers/scsi/sg.c:2319:16: sparse: expected restricted
vm_fault_t
drivers/scsi/sg.c:2319:16: sparse: got int [assigned] res
vim +2270 drivers/scsi/sg.c
2264
2265 /* Note: the error return: VM_FAULT_SIGBUS causes a "bus error" */
2266 static vm_fault_t
2267 sg_vma_fault(struct vm_fault *vmf)
2268 {
2269 int k, n, length;
2270 int res = VM_FAULT_SIGBUS;
2271 unsigned long offset;
2272 struct vm_area_struct *vma = vmf->vma;
2273 struct page *page;
2274 struct sg_scatter_hold *rsv_schp;
2275 struct sg_request *srp;
2276 struct sg_device *sdp;
2277 struct sg_fd *sfp;
2278 const char *nbp = "==NULL, bad";
2279
2280 if (!vma) {
2281 pr_warn("%s: vma%s\n", __func__, nbp);
2282 goto out_err;
2283 }
2284 sfp = vma->vm_private_data;
2285 if (!sfp) {
2286 pr_warn("%s: sfp%s\n", __func__, nbp);
2287 goto out_err;
2288 }
2289 sdp = sfp->parentdp;
2290 if (sdp && unlikely(SG_IS_DETACHING(sdp))) {
2291 SG_LOG(1, sfp, "%s: device detaching\n", __func__);
2292 goto out_err;
2293 }
2294 srp = sfp->rsv_srp;
2295 if (!srp) {
2296 SG_LOG(1, sfp, "%s: srp%s\n", __func__, nbp);
2297 goto out_err;
2298 }
2299 mutex_lock(&sfp->f_mutex);
2300 rsv_schp = &srp->sgat_h;
2301 offset = vmf->pgoff << PAGE_SHIFT;
2302 if (offset >= (unsigned int)rsv_schp->buflen) {
2303 SG_LOG(1, sfp, "%s: offset[%lu] >= rsv.buflen\n", __func__,
2304 offset);
2305 goto out_err_unlock;
2306 }
2307 SG_LOG(5, sfp, "%s: vm_start=0x%lx, off=%lu\n", __func__,
2308 vma->vm_start, offset);
2309 length = 1 << (PAGE_SHIFT + rsv_schp->page_order);
2310 k = (int)offset / length;
2311 n = ((int)offset % length) >> PAGE_SHIFT;
2312 page = nth_page(rsv_schp->pages[k], n);
2313 get_page(page);
2314 vmf->page = page;
2315 res = 0;
2316 out_err_unlock:
2317 mutex_unlock(&sfp->f_mutex);
2318 out_err:
2319 return res;
2320 }
2321
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org