Re: [PATCH] rpmsg: virtio: set dst address on first message received

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Arnaud,

I love your patch! Perhaps something to improve:

[auto build test WARNING on remoteproc/rpmsg-next]
[also build test WARNING on v5.17-rc8 next-20220315]
[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]

url:    https://github.com/0day-ci/linux/commits/Arnaud-Pouliquen/rpmsg-virtio-set-dst-address-on-first-message-received/20220315-234049
base:   git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux.git rpmsg-next
config: s390-randconfig-s031-20220313 (https://download.01.org/0day-ci/archive/20220316/202203160614.sjUMuSy8-lkp@xxxxxxxxx/config)
compiler: s390-linux-gcc (GCC) 11.2.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.4-dirty
        # https://github.com/0day-ci/linux/commit/ef182a34773917f6bf876b37485031962393a1cd
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Arnaud-Pouliquen/rpmsg-virtio-set-dst-address-on-first-message-received/20220315-234049
        git checkout ef182a34773917f6bf876b37485031962393a1cd
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=s390 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)
>> drivers/rpmsg/virtio_rpmsg_bus.c:756:36: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] dst @@     got restricted __rpmsg32 [usertype] src @@
   drivers/rpmsg/virtio_rpmsg_bus.c:756:36: sparse:     expected unsigned int [usertype] dst
   drivers/rpmsg/virtio_rpmsg_bus.c:756:36: sparse:     got restricted __rpmsg32 [usertype] src

vim +756 drivers/rpmsg/virtio_rpmsg_bus.c

   727	
   728		/*
   729		 * We currently use fixed-sized buffers, so trivially sanitize
   730		 * the reported payload length.
   731		 */
   732		if (len > vrp->buf_size ||
   733		    msg_len > (len - sizeof(struct rpmsg_hdr))) {
   734			dev_warn(dev, "inbound msg too big: (%d, %d)\n", len, msg_len);
   735			return -EINVAL;
   736		}
   737	
   738		/* use the dst addr to fetch the callback of the appropriate user */
   739		mutex_lock(&vrp->endpoints_lock);
   740	
   741		ept = idr_find(&vrp->endpoints, __rpmsg32_to_cpu(little_endian, msg->dst));
   742	
   743		/* let's make sure no one deallocates ept while we use it */
   744		if (ept)
   745			kref_get(&ept->refcount);
   746	
   747		mutex_unlock(&vrp->endpoints_lock);
   748	
   749		if (ept) {
   750			rpdev = ept->rpdev;
   751			if (rpdev->ept == ept && rpdev->dst == RPMSG_ADDR_ANY) {
   752				/*
   753				 * First message received from the remote side on the default endpoint,
   754				 * update channel destination address.
   755				 */
 > 756				rpdev->dst = msg->src;
   757			}
   758	
   759			/* make sure ept->cb doesn't go away while we use it */
   760			mutex_lock(&ept->cb_lock);
   761	
   762			if (ept->cb)
   763				ept->cb(ept->rpdev, msg->data, msg_len, ept->priv,
   764					__rpmsg32_to_cpu(little_endian, msg->src));
   765	
   766			mutex_unlock(&ept->cb_lock);
   767	
   768			/* farewell, ept, we don't need you anymore */
   769			kref_put(&ept->refcount, __ept_release);
   770		} else
   771			dev_warn_ratelimited(dev, "msg received with no recipient\n");
   772	
   773		/* publish the real size of the buffer */
   774		rpmsg_sg_init(&sg, msg, vrp->buf_size);
   775	
   776		/* add the buffer back to the remote processor's virtqueue */
   777		err = virtqueue_add_inbuf(vrp->rvq, &sg, 1, msg, GFP_KERNEL);
   778		if (err < 0) {
   779			dev_err(dev, "failed to add a virtqueue buffer: %d\n", err);
   780			return err;
   781		}
   782	
   783		return 0;
   784	}
   785	

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



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux