iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Barry Song <song.bao.hua@hisilicon.com>,
	hch@lst.de,  m.szyprowski@samsung.com, robin.murphy@arm.com,
	catalin.marinas@arm.com
Cc: kbuild-all@lists.01.org, lkp@intel.com,
	linux-kernel@vger.kernel.org, linuxarm@huawei.com,
	iommu@lists.linux-foundation.org,
	linux-arm-kernel@lists.infradead.org,
	Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH 1/3] dma-direct: provide the ability to reserve per-numa CMA
Date: Thu, 4 Jun 2020 14:36:31 +0300	[thread overview]
Message-ID: <20200604113631.GP30374@kadam> (raw)
In-Reply-To: <20200603024231.61748-2-song.bao.hua@hisilicon.com>

[-- Attachment #1: Type: text/plain, Size: 3166 bytes --]

Hi Barry,

url:    https://github.com/0day-ci/linux/commits/Barry-Song/support-per-numa-CMA-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@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32337 bytes --]

[-- Attachment #3: Type: text/plain, Size: 156 bytes --]

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  parent reply	other threads:[~2020-06-04 11:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03  2:42 [PATCH 0/3] support per-numa CMA for ARM server Barry Song
2020-06-03  2:42 ` [PATCH 1/3] dma-direct: provide the ability to reserve per-numa CMA Barry Song
2020-06-03  6:55   ` kbuild test robot
2020-06-03  7:18   ` kbuild test robot
2020-06-03  7:18   ` [RFC PATCH] dma-direct: dma_contiguous_pernuma_area[] can be static kbuild test robot
2020-06-04 11:36   ` Dan Carpenter [this message]
2020-06-05  6:04     ` [PATCH 1/3] dma-direct: provide the ability to reserve per-numa CMA Song Bao Hua (Barry Song)
2020-06-05  8:57       ` Dan Carpenter
2020-06-06  3:46         ` [kbuild-all] " Philip Li
2020-06-06 10:15           ` Song Bao Hua (Barry Song)
2020-06-05 13:57   ` kernel test robot
2020-06-03  2:42 ` [PATCH 2/3] arm64: mm: reserve hugetlb CMA after numa_init Barry Song
2020-06-03  3:22   ` Roman Gushchin via iommu
2020-06-07 20:14     ` Matthias Brugger
2020-06-08  0:50       ` Song Bao Hua (Barry Song)
2020-06-09 15:33         ` Matthias Brugger
2020-06-03  2:42 ` [PATCH 3/3] arm64: mm: reserve per-numa " Barry Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200604113631.GP30374@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=catalin.marinas@arm.com \
    --cc=error27@gmail.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=lkp@intel.com \
    --cc=m.szyprowski@samsung.com \
    --cc=robin.murphy@arm.com \
    --cc=song.bao.hua@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).