Re: [PATCH v7 1/5] misc: fastrpc: Add fastrpc multimode invoke request support

From: kernel test robot
Date: Wed Nov 22 2023 - 10:48:34 EST


Hi Ekansh,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.7-rc2 next-20231122]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Ekansh-Gupta/misc-fastrpc-Add-fastrpc-multimode-invoke-request-support/20231121-175147
base: linus/master
patch link: https://lore.kernel.org/r/20231121094844.5764-2-quic_ekangupt%40quicinc.com
patch subject: [PATCH v7 1/5] misc: fastrpc: Add fastrpc multimode invoke request support
config: mips-randconfig-r122-20231122 (https://download.01.org/0day-ci/archive/20231122/202311222004.ycVXExec-lkp@xxxxxxxxx/config)
compiler: mips-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231122/202311222004.ycVXExec-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311222004.ycVXExec-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/misc/fastrpc.c:607:59: sparse: sparse: non size-preserving integer to pointer cast
>> drivers/misc/fastrpc.c:1318:33: sparse: sparse: non size-preserving pointer to integer cast
drivers/misc/fastrpc.c:1451:33: sparse: sparse: non size-preserving pointer to integer cast
drivers/misc/fastrpc.c:1515:33: sparse: sparse: non size-preserving pointer to integer cast
drivers/misc/fastrpc.c:1663:33: sparse: sparse: non size-preserving pointer to integer cast
drivers/misc/fastrpc.c:1694:33: sparse: sparse: non size-preserving pointer to integer cast
drivers/misc/fastrpc.c:1741:40: sparse: sparse: non size-preserving pointer to integer cast
drivers/misc/fastrpc.c:1771:33: sparse: sparse: non size-preserving pointer to integer cast
drivers/misc/fastrpc.c:1874:33: sparse: sparse: non size-preserving pointer to integer cast
drivers/misc/fastrpc.c:1972:33: sparse: sparse: non size-preserving pointer to integer cast
drivers/misc/fastrpc.c:2053:33: sparse: sparse: non size-preserving pointer to integer cast
drivers/misc/fastrpc.c:2124:33: sparse: sparse: non size-preserving pointer to integer cast

vim +607 drivers/misc/fastrpc.c

573
574 static struct fastrpc_invoke_ctx *fastrpc_context_alloc(
575 struct fastrpc_user *user, u32 kernel, u32 sc,
576 struct fastrpc_enhanced_invoke *invoke)
577 {
578 struct fastrpc_channel_ctx *cctx = user->cctx;
579 struct fastrpc_invoke_ctx *ctx = NULL;
580 unsigned long flags;
581 int ret;
582
583 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
584 if (!ctx)
585 return ERR_PTR(-ENOMEM);
586
587 INIT_LIST_HEAD(&ctx->node);
588 ctx->fl = user;
589 ctx->nscalars = REMOTE_SCALARS_LENGTH(sc);
590 ctx->nbufs = REMOTE_SCALARS_INBUFS(sc) +
591 REMOTE_SCALARS_OUTBUFS(sc);
592
593 if (ctx->nscalars) {
594 ctx->maps = kcalloc(ctx->nscalars,
595 sizeof(*ctx->maps), GFP_KERNEL);
596 if (!ctx->maps) {
597 kfree(ctx);
598 return ERR_PTR(-ENOMEM);
599 }
600 ctx->olaps = kcalloc(ctx->nscalars,
601 sizeof(*ctx->olaps), GFP_KERNEL);
602 if (!ctx->olaps) {
603 kfree(ctx->maps);
604 kfree(ctx);
605 return ERR_PTR(-ENOMEM);
606 }
> 607 ctx->args = (struct fastrpc_invoke_args *)invoke->inv.args;
608 fastrpc_get_buff_overlaps(ctx);
609 }
610
611 /* Released in fastrpc_context_put() */
612 fastrpc_channel_ctx_get(cctx);
613
614 ctx->sc = sc;
615 ctx->retval = -1;
616 ctx->pid = current->pid;
617 ctx->tgid = user->tgid;
618 ctx->cctx = cctx;
619 init_completion(&ctx->work);
620 INIT_WORK(&ctx->put_work, fastrpc_context_put_wq);
621
622 spin_lock(&user->lock);
623 list_add_tail(&ctx->node, &user->pending);
624 spin_unlock(&user->lock);
625
626 spin_lock_irqsave(&cctx->lock, flags);
627 ret = idr_alloc_cyclic(&cctx->ctx_idr, ctx, 1,
628 FASTRPC_CTX_MAX, GFP_ATOMIC);
629 if (ret < 0) {
630 spin_unlock_irqrestore(&cctx->lock, flags);
631 goto err_idr;
632 }
633 ctx->ctxid = ret << 4;
634 spin_unlock_irqrestore(&cctx->lock, flags);
635
636 kref_init(&ctx->refcount);
637
638 return ctx;
639 err_idr:
640 spin_lock(&user->lock);
641 list_del(&ctx->node);
642 spin_unlock(&user->lock);
643 fastrpc_channel_ctx_put(cctx);
644 kfree(ctx->maps);
645 kfree(ctx->olaps);
646 kfree(ctx);
647
648 return ERR_PTR(ret);
649 }
650

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki