Content-Type: multipart/mixed; boundary="===============6624164227347488505==" MIME-Version: 1.0 From: Jason Wang To: kbuild-all@lists.01.org Subject: Re: [PATCH 5/5] vdpasim: vDPA device simulator Date: Tue, 04 Feb 2020 12:07:00 +0800 Message-ID: In-Reply-To: <20200128033215.GO1870@kadam> List-Id: --===============6624164227347488505== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On 2020/1/28 =E4=B8=8A=E5=8D=8811:32, Dan Carpenter wrote: > Hi Jason, > > url: https://github.com/0day-ci/linux/commits/Jason-Wang/vDPA-support/= 20200117-170243 > base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git lin= ux-next Will fix this. Thanks > > If you fix the issue, kindly add following tag > Reported-by: kbuild test robot > Reported-by: Dan Carpenter > > smatch warnings: > drivers/virtio/vdpa/vdpa_sim.c:288 vdpasim_alloc_coherent() warn: returni= ng freed memory 'addr' > > # https://github.com/0day-ci/linux/commit/55047769b3e974d68b2aab5ce002245= 9b172a23f > git remote add linux-review https://github.com/0day-ci/linux > git remote update linux-review > git checkout 55047769b3e974d68b2aab5ce0022459b172a23f > vim +/addr +288 drivers/virtio/vdpa/vdpa_sim.c > > 55047769b3e974 Jason Wang 2020-01-16 263 static void *vdpasim_alloc_coh= erent(struct device *dev, size_t size, > 55047769b3e974 Jason Wang 2020-01-16 264 dma_addr_t *dma_addr, = gfp_t flag, > 55047769b3e974 Jason Wang 2020-01-16 265 unsigned long attrs) > 55047769b3e974 Jason Wang 2020-01-16 266 { > 55047769b3e974 Jason Wang 2020-01-16 267 struct vdpa_device *vdpa =3D = dev_to_vdpa(dev); > 55047769b3e974 Jason Wang 2020-01-16 268 struct vdpasim *vdpasim =3D v= dpa_to_sim(vdpa); > 55047769b3e974 Jason Wang 2020-01-16 269 struct vhost_iotlb *iommu =3D= vdpasim->iommu; > 55047769b3e974 Jason Wang 2020-01-16 270 void *addr =3D kmalloc(size, = flag); > 55047769b3e974 Jason Wang 2020-01-16 271 int ret; > 55047769b3e974 Jason Wang 2020-01-16 272 > 55047769b3e974 Jason Wang 2020-01-16 273 if (!addr) > 55047769b3e974 Jason Wang 2020-01-16 274 *dma_addr =3D DMA_MAPPING_ER= ROR; > 55047769b3e974 Jason Wang 2020-01-16 275 else { > 55047769b3e974 Jason Wang 2020-01-16 276 u64 pa =3D virt_to_phys(addr= ); > 55047769b3e974 Jason Wang 2020-01-16 277 > 55047769b3e974 Jason Wang 2020-01-16 278 ret =3D vhost_iotlb_add_rang= e(iommu, (u64)pa, > 55047769b3e974 Jason Wang 2020-01-16 279 (u64)pa + size - 1, > 55047769b3e974 Jason Wang 2020-01-16 280 pa, VHOST_MAP_RW); > 55047769b3e974 Jason Wang 2020-01-16 281 if (ret) { > 55047769b3e974 Jason Wang 2020-01-16 282 kfree(addr); > ^^^^^^^^= ^^^ > 55047769b3e974 Jason Wang 2020-01-16 283 *dma_addr =3D DMA_MAPPING_E= RROR; > 55047769b3e974 Jason Wang 2020-01-16 284 } else > 55047769b3e974 Jason Wang 2020-01-16 285 *dma_addr =3D (dma_addr_t)p= a; > 55047769b3e974 Jason Wang 2020-01-16 286 } > 55047769b3e974 Jason Wang 2020-01-16 287 > 55047769b3e974 Jason Wang 2020-01-16 @288 return addr; > ^^^^^^^^^^^^ > 55047769b3e974 Jason Wang 2020-01-16 289 } > > --- > 0-DAY kernel test infrastructure Open Source Technology C= enter > https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corp= oration > --===============6624164227347488505==--