[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <B926444035E5E2439431908E3842AFD24E0011@DGGEMI525-MBS.china.huawei.com>
Date: Fri, 5 Jun 2020 06:04:31 +0000
From: "Song Bao Hua (Barry Song)" <song.bao.hua@...ilicon.com>
To: Dan Carpenter <dan.carpenter@...cle.com>,
"kbuild@...ts.01.org" <kbuild@...ts.01.org>,
"hch@....de" <hch@....de>,
"m.szyprowski@...sung.com" <m.szyprowski@...sung.com>,
"robin.murphy@....com" <robin.murphy@....com>,
"catalin.marinas@....com" <catalin.marinas@....com>
CC: "lkp@...el.com" <lkp@...el.com>, Dan Carpenter <error27@...il.com>,
"kbuild-all@...ts.01.org" <kbuild-all@...ts.01.org>,
"iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Linuxarm <linuxarm@...wei.com>,
"Jonathan Cameron" <jonathan.cameron@...wei.com>,
John Garry <john.garry@...wei.com>
Subject: RE: [PATCH 1/3] dma-direct: provide the ability to reserve per-numa
CMA
> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@...cle.com]
> Sent: Thursday, June 4, 2020 11:37 PM
> To: kbuild@...ts.01.org; Song Bao Hua (Barry Song)
> <song.bao.hua@...ilicon.com>; hch@....de; m.szyprowski@...sung.com;
> robin.murphy@....com; catalin.marinas@....com
> Cc: lkp@...el.com; Dan Carpenter <error27@...il.com>;
> kbuild-all@...ts.01.org; iommu@...ts.linux-foundation.org;
> linux-arm-kernel@...ts.infradead.org; linux-kernel@...r.kernel.org; Linuxarm
> <linuxarm@...wei.com>; Jonathan Cameron
> <jonathan.cameron@...wei.com>; John Garry <john.garry@...wei.com>
> Subject: Re: [PATCH 1/3] dma-direct: provide the ability to reserve per-numa
> CMA
>
> Hi Barry,
>
> url:
> https://github.com/0day-ci/linux/commits/Barry-Song/support-per-numa-CM
> A-for-ARM-server/20200603-104821
> base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git
> for-next/core
> config: x86_64-randconfig-m001-20200603 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@...el.com>
> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Dan, thanks! Good catch!
as this patch has not been in mainline yet, is it correct to add these "reported-by" in patch v2?
Barry
>
> smatch warnings:
> kernel/dma/contiguous.c:274 dma_alloc_contiguous() warn: variable
> dereferenced before check 'dev' (see line 272)
>
> #
> https://github.com/0day-ci/linux/commit/adb919e972c1cac3d8b11905d525
> 8d23d3aac6a4
> git remote add linux-review https://github.com/0day-ci/linux git remote
> update linux-review git checkout
> adb919e972c1cac3d8b11905d5258d23d3aac6a4
> vim +/dev +274 kernel/dma/contiguous.c
>
> b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen
> 2019-05-23 267 struct page *dma_alloc_contiguous(struct device *dev,
> size_t size, gfp_t gfp)
> b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen
> 2019-05-23 268 {
> 90ae409f9eb3bc kernel/dma/contiguous.c Christoph Hellwig
> 2019-08-20 269 size_t count = size >> PAGE_SHIFT;
> b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen
> 2019-05-23 270 struct page *page = NULL;
> bd2e75633c8012 kernel/dma/contiguous.c Nicolin Chen
> 2019-05-23 271 struct cma *cma = NULL;
> adb919e972c1ca kernel/dma/contiguous.c Barry Song
> 2020-06-03 @272 int nid = dev_to_node(dev);
>
> ^^^ Dereferenced inside function.
>
> bd2e75633c8012 kernel/dma/contiguous.c Nicolin Chen
> 2019-05-23 273
> bd2e75633c8012 kernel/dma/contiguous.c Nicolin Chen
> 2019-05-23 @274 if (dev && dev->cma_area)
>
> ^^^ Too late.
>
> bd2e75633c8012 kernel/dma/contiguous.c Nicolin Chen
> 2019-05-23 275 cma = dev->cma_area;
> adb919e972c1ca kernel/dma/contiguous.c Barry Song
> 2020-06-03 276 else if ((nid != NUMA_NO_NODE) &&
> dma_contiguous_pernuma_area[nid]
> adb919e972c1ca kernel/dma/contiguous.c Barry Song
> 2020-06-03 277 && !(gfp & (GFP_DMA | GFP_DMA32)))
> adb919e972c1ca kernel/dma/contiguous.c Barry Song
> 2020-06-03 278 cma = dma_contiguous_pernuma_area[nid];
> bd2e75633c8012 kernel/dma/contiguous.c Nicolin Chen
> 2019-05-23 279 else if (count > 1)
> bd2e75633c8012 kernel/dma/contiguous.c Nicolin Chen
> 2019-05-23 280 cma = dma_contiguous_default_area;
> b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen
> 2019-05-23 281
> b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen
> 2019-05-23 282 /* CMA can be used only in the context which permits
> sleeping */
> b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen
> 2019-05-23 283 if (cma && gfpflags_allow_blocking(gfp)) {
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Powered by blists - more mailing lists