Hi Jorge,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[cannot apply to v5.3 next-20190915]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:    
https://github.com/0day-ci/linux/commits/Jorge-Ramirez-Ortiz/misc-fastrpc-fixes-and-map-unmap-support/20190916-150416
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 7.4.0
reproduce:
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=arm 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <l...@intel.com>

All warnings (new ones prefixed by >>):

   drivers/misc/fastrpc.c: In function 'fastrpc_req_mmap':
>> drivers/misc/fastrpc.c:1399:16: warning: cast from pointer to integer of 
>> different size [-Wpointer-to-int-cast]
     args[0].ptr = (u64) &req_msg;
                   ^
   drivers/misc/fastrpc.c:1405:16: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]
     args[1].ptr = (u64) &pages;
                   ^
   drivers/misc/fastrpc.c:1408:16: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]
     args[2].ptr = (u64) &rsp_msg;
                   ^

vim +1399 drivers/misc/fastrpc.c

  1361  
  1362  static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp)
  1363  {
  1364          struct fastrpc_invoke_args args[3] = { [0 ... 2] = { 0 } };
  1365          struct fastrpc_buf *buf = NULL;
  1366          struct fastrpc_mmap_req_msg req_msg;
  1367          struct fastrpc_mmap_rsp_msg rsp_msg;
  1368          struct fastrpc_req_munmap req_unmap;
  1369          struct fastrpc_phy_page pages;
  1370          struct fastrpc_req_mmap req;
  1371          struct device *dev = fl->sctx->dev;
  1372          int err;
  1373          u32 sc;
  1374  
  1375          if (copy_from_user(&req, argp, sizeof(req)))
  1376                  return -EFAULT;
  1377  
  1378          if (req.flags != ADSP_MMAP_ADD_PAGES) {
  1379                  dev_err(dev, "flag not supported 0x%x\n", req.flags);
  1380                  return -EINVAL;
  1381          }
  1382  
  1383          if (req.vaddrin) {
  1384                  dev_err(dev, "adding user allocated pages is not 
supported\n");
  1385                  return -EINVAL;
  1386          }
  1387  
  1388          err = fastrpc_buf_alloc(fl, fl->sctx->dev, req.size, &buf);
  1389          if (err) {
  1390                  dev_err(dev, "failed to allocate buffer\n");
  1391                  return err;
  1392          }
  1393  
  1394          req_msg.pgid = fl->tgid;
  1395          req_msg.flags = req.flags;
  1396          req_msg.vaddr = req.vaddrin;
  1397          req_msg.num = sizeof(pages);
  1398  
> 1399          args[0].ptr = (u64) &req_msg;
  1400          args[0].length = sizeof(req_msg);
  1401  
  1402          pages.addr = buf->phys;
  1403          pages.size = buf->size;
  1404  
  1405          args[1].ptr = (u64) &pages;
  1406          args[1].length = sizeof(pages);
  1407  
  1408          args[2].ptr = (u64) &rsp_msg;
  1409          args[2].length = sizeof(rsp_msg);
  1410  
  1411          sc = FASTRPC_SCALARS(FASTRPC_RMID_INIT_MMAP, 2, 1);
  1412          err = fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, sc,
  1413                                        &args[0]);
  1414          if (err) {
  1415                  dev_err(dev, "mmap error (len 0x%08llx)\n", buf->size);
  1416                  goto err_invoke;
  1417          }
  1418  
  1419          /* update the buffer to be able to deallocate the memory on the 
DSP */
  1420          buf->raddr = (uintptr_t) rsp_msg.vaddr;
  1421  
  1422          /* let the client know the address to use */
  1423          req.vaddrout = rsp_msg.vaddr;
  1424  
  1425          spin_lock(&fl->lock);
  1426          list_add_tail(&buf->node, &fl->mmaps);
  1427          spin_unlock(&fl->lock);
  1428  
  1429          if (copy_to_user((void __user *)argp, &req, sizeof(req))) {
  1430                  /* unmap the memory and release the buffer */
  1431                  req_unmap.vaddrout = buf->raddr;
  1432                  req_unmap.size = buf->size;
  1433                  fastrpc_req_munmap_impl(fl, &req_unmap);
  1434                  return -EFAULT;
  1435          }
  1436  
  1437          dev_dbg(dev, "mmap\t\tpt 0x%09lx OK [len 0x%08llx]\n",
  1438                  buf->raddr, buf->size);
  1439  
  1440          return 0;
  1441  
  1442  err_invoke:
  1443          fastrpc_buf_free(buf);
  1444  
  1445          return err;
  1446  }
  1447  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

Reply via email to