Hi Srinivas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on v4.20-rc6 next-20181207]
[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/Srinivas-Kandagatla/misc-Add-support-to-Qualcomm-FastRPC-driver/20181210-093054
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.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.2.0 make.cross ARCH=arm 

All warnings (new ones prefixed by >>):

   drivers//misc/fastrpc.c: In function 'fastrpc_get_args':
>> drivers//misc/fastrpc.c:528:17: warning: cast from pointer to integer of 
>> different size [-Wpointer-to-int-cast]
       rpra[i].pv = (uint64_t) ctx->args[i].ptr;
                    ^
>> drivers//misc/fastrpc.c:545:26: warning: cast to pointer from integer of 
>> different size [-Wint-to-pointer-cast]
        err = copy_from_user((void *)rpra[i].pv,
                             ^
   drivers//misc/fastrpc.c:551:12: warning: cast to pointer from integer of 
different size [-Wint-to-pointer-cast]
        memcpy((void *)rpra[i].pv, ctx->args[i].ptr,
               ^
   drivers//misc/fastrpc.c:558:16: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]
      rpra[i].pv = (uint64_t) ctx->args[i].ptr;
                   ^
   drivers//misc/fastrpc.c: In function 'fastrpc_put_args':
   drivers//misc/fastrpc.c:591:8: warning: cast to pointer from integer of 
different size [-Wint-to-pointer-cast]
           (void  *)rpra[i].pv, rpra[i].len);
           ^
   drivers//misc/fastrpc.c:597:29: warning: cast to pointer from integer of 
different size [-Wint-to-pointer-cast]
       memcpy(ctx->args[i].ptr, (void *)rpra[i].pv,
                                ^

vim +528 drivers//misc/fastrpc.c

   485  
   486  static int fastrpc_get_args(uint32_t kernel, struct fastrpc_invoke_ctx 
*ctx)
   487  {
   488          struct device *dev = ctx->fl->sctx->dev;
   489          struct fastrpc_remote_arg *rpra;
   490          struct fastrpc_invoke_buf *list;
   491          struct fastrpc_phy_page *pages;
   492          uintptr_t args;
   493          size_t rlen = 0, pkt_size = 0, metalen = 0;
   494          int inbufs, i, err = 0;
   495  
   496          inbufs = REMOTE_SCALARS_INBUFS(ctx->sc);
   497          metalen = fastrpc_get_meta_size(ctx);
   498          pkt_size = fastrpc_get_payload_size(ctx, metalen);
   499          fastrpc_create_maps(ctx);
   500          ctx->used_sz = pkt_size;
   501  
   502          err = fastrpc_buf_alloc(ctx->fl, dev, pkt_size, &ctx->buf);
   503          if (err)
   504                  goto bail;
   505  
   506          rpra = ctx->buf->virt;
   507          list = ctx->buf->virt + ctx->nscalars * sizeof(*rpra);
   508          pages = ctx->buf->virt + ctx->nscalars * (sizeof(*list) +
   509                  sizeof(*rpra));
   510          args = (uintptr_t)ctx->buf->virt + metalen;
   511          rlen = pkt_size - metalen;
   512          ctx->rpra = rpra;
   513  
   514          for (i = 0; i < ctx->nbufs; ++i) {
   515                  size_t len = ctx->args[i].length;
   516  
   517                  rpra[i].pv = 0;
   518                  rpra[i].len = len;
   519                  list[i].num = len ? 1 : 0;
   520                  list[i].pgidx = i;
   521  
   522                  if (!len)
   523                          continue;
   524  
   525                  pages[i].size = roundup(len, PAGE_SIZE);
   526  
   527                  if (ctx->maps[i]) {
 > 528                          rpra[i].pv = (uint64_t) ctx->args[i].ptr;
   529                          pages[i].addr = ctx->maps[i]->phys;
   530                  } else {
   531                          rlen -= ALIGN(args, FASTRPC_ALIGN) - args;
   532                          args = ALIGN(args, FASTRPC_ALIGN);
   533                          if (rlen < len)
   534                                  goto bail;
   535  
   536                          rpra[i].pv = (args);
   537                          pages[i].addr = ctx->buf->phys + (pkt_size - 
rlen);
   538                          pages[i].addr = pages[i].addr & PAGE_MASK;
   539                          args = args + len;
   540                          rlen -= len;
   541                  }
   542  
   543                  if (i < inbufs && !ctx->maps[i]) {
   544                          if (!kernel) {
 > 545                                  err = copy_from_user((void *)rpra[i].pv,
   546                                               (void __user 
*)ctx->args[i].ptr,
   547                                               ctx->args[i].length);
   548                                  if (err)
   549                                          goto bail;
   550                          } else {
   551                                  memcpy((void *)rpra[i].pv, 
ctx->args[i].ptr,
   552                                         ctx->args[i].length);
   553                          }
   554                  }
   555          }
   556  
   557          for (i = ctx->nbufs; i < ctx->nscalars; ++i) {
   558                  rpra[i].pv = (uint64_t) ctx->args[i].ptr;
   559                  rpra[i].len = ctx->args[i].length;
   560                  list[i].num = ctx->args[i].length ? 1 : 0;
   561                  list[i].pgidx = i;
   562                  pages[i].addr = ctx->maps[i]->phys;
   563                  pages[i].size = ctx->maps[i]->size;
   564          }
   565  
   566  bail:
   567          if (err)
   568                  dev_err(dev, "Error: get invoke args failed:%d\n", err);
   569  
   570          return err;
   571  }
   572  

---
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