From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Dave Jiang <dave.jiang@intel.com>, vkoul@kernel.org
Cc: lkp@intel.com, kbuild-all@lists.01.org,
Nikhil Rao <nikhil.rao@intel.com>,
dmaengine@vger.kernel.org
Subject: Re: [PATCH] dmaengine: idxd: fix cdev locking for open and release
Date: Mon, 22 Jun 2020 14:59:51 +0300 [thread overview]
Message-ID: <20200622115951.GC4151@kadam> (raw)
In-Reply-To: <159225445529.68253.775183898115820961.stgit@djiang5-desk3.ch.intel.com>
[-- Attachment #1: Type: text/plain, Size: 3991 bytes --]
Hi Dave,
url: https://github.com/0day-ci/linux/commits/Dave-Jiang/dmaengine-idxd-fix-cdev-locking-for-open-and-release/20200616-045722
base: https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/slave-dma.git next
config: x86_64-randconfig-m001-20200620 (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:
drivers/dma/idxd/cdev.c:106 idxd_cdev_open() error: uninitialized symbol 'ctx'.
# https://github.com/0day-ci/linux/commit/26b4f2328e66ceefd1ef3be3bea9217d1b7cdda1
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 26b4f2328e66ceefd1ef3be3bea9217d1b7cdda1
vim +/ctx +106 drivers/dma/idxd/cdev.c
42d279f9137ab7 Dave Jiang 2020-01-21 70
42d279f9137ab7 Dave Jiang 2020-01-21 71 static int idxd_cdev_open(struct inode *inode, struct file *filp)
42d279f9137ab7 Dave Jiang 2020-01-21 72 {
42d279f9137ab7 Dave Jiang 2020-01-21 73 struct idxd_user_context *ctx;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42d279f9137ab7 Dave Jiang 2020-01-21 74 struct idxd_device *idxd;
42d279f9137ab7 Dave Jiang 2020-01-21 75 struct idxd_wq *wq;
42d279f9137ab7 Dave Jiang 2020-01-21 76 struct device *dev;
26b4f2328e66ce Nikhil Rao 2020-06-15 77 int rc;
42d279f9137ab7 Dave Jiang 2020-01-21 78
42d279f9137ab7 Dave Jiang 2020-01-21 79 wq = inode_wq(inode);
42d279f9137ab7 Dave Jiang 2020-01-21 80 idxd = wq->idxd;
42d279f9137ab7 Dave Jiang 2020-01-21 81 dev = &idxd->pdev->dev;
42d279f9137ab7 Dave Jiang 2020-01-21 82
988aad2f111c76 Dave Jiang 2020-03-12 83 dev_dbg(dev, "%s called: %d\n", __func__, idxd_wq_refcount(wq));
42d279f9137ab7 Dave Jiang 2020-01-21 84
26b4f2328e66ce Nikhil Rao 2020-06-15 85 mutex_lock(&wq->wq_lock);
26b4f2328e66ce Nikhil Rao 2020-06-15 86
26b4f2328e66ce Nikhil Rao 2020-06-15 87 if (idxd_wq_refcount(wq) > 0 && wq_dedicated(wq)) {
26b4f2328e66ce Nikhil Rao 2020-06-15 88 rc = -EBUSY;
26b4f2328e66ce Nikhil Rao 2020-06-15 89 goto failed;
^^^^^^^^^^^
26b4f2328e66ce Nikhil Rao 2020-06-15 90 }
42d279f9137ab7 Dave Jiang 2020-01-21 91
42d279f9137ab7 Dave Jiang 2020-01-21 92 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
It's probably better for performance to move this allocation outside the
lock anyway.
int rc = 0;
...
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
if (!ctx)
return -ENOMEM;
mutex_lock(&wq->wq_lock);
if (idxd_wq_refcount(wq) > 0 && wq_dedicated(wq)) {
rc = -EBUSY;
goto unlock;
}
...
unlock:
mutex_unlock(&wq->wq_lock);
return rc;
26b4f2328e66ce Nikhil Rao 2020-06-15 93 if (!ctx) {
26b4f2328e66ce Nikhil Rao 2020-06-15 94 rc = -ENOMEM;
26b4f2328e66ce Nikhil Rao 2020-06-15 95 goto failed;
26b4f2328e66ce Nikhil Rao 2020-06-15 96 }
42d279f9137ab7 Dave Jiang 2020-01-21 97
42d279f9137ab7 Dave Jiang 2020-01-21 98 ctx->wq = wq;
42d279f9137ab7 Dave Jiang 2020-01-21 99 filp->private_data = ctx;
42d279f9137ab7 Dave Jiang 2020-01-21 100 idxd_wq_get(wq);
26b4f2328e66ce Nikhil Rao 2020-06-15 101 mutex_unlock(&wq->wq_lock);
42d279f9137ab7 Dave Jiang 2020-01-21 102 return 0;
26b4f2328e66ce Nikhil Rao 2020-06-15 103
26b4f2328e66ce Nikhil Rao 2020-06-15 104 failed:
26b4f2328e66ce Nikhil Rao 2020-06-15 105 mutex_unlock(&wq->wq_lock);
26b4f2328e66ce Nikhil Rao 2020-06-15 @106 kfree(ctx);
^^^^^^^^^
Uninitialized.
26b4f2328e66ce Nikhil Rao 2020-06-15 107 return rc;
42d279f9137ab7 Dave Jiang 2020-01-21 108 }
---
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: 32004 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH] dmaengine: idxd: fix cdev locking for open and release
Date: Mon, 22 Jun 2020 14:59:51 +0300 [thread overview]
Message-ID: <20200622115951.GC4151@kadam> (raw)
In-Reply-To: <159225445529.68253.775183898115820961.stgit@djiang5-desk3.ch.intel.com>
[-- Attachment #1: Type: text/plain, Size: 4088 bytes --]
Hi Dave,
url: https://github.com/0day-ci/linux/commits/Dave-Jiang/dmaengine-idxd-fix-cdev-locking-for-open-and-release/20200616-045722
base: https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/slave-dma.git next
config: x86_64-randconfig-m001-20200620 (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:
drivers/dma/idxd/cdev.c:106 idxd_cdev_open() error: uninitialized symbol 'ctx'.
# https://github.com/0day-ci/linux/commit/26b4f2328e66ceefd1ef3be3bea9217d1b7cdda1
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 26b4f2328e66ceefd1ef3be3bea9217d1b7cdda1
vim +/ctx +106 drivers/dma/idxd/cdev.c
42d279f9137ab7 Dave Jiang 2020-01-21 70
42d279f9137ab7 Dave Jiang 2020-01-21 71 static int idxd_cdev_open(struct inode *inode, struct file *filp)
42d279f9137ab7 Dave Jiang 2020-01-21 72 {
42d279f9137ab7 Dave Jiang 2020-01-21 73 struct idxd_user_context *ctx;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42d279f9137ab7 Dave Jiang 2020-01-21 74 struct idxd_device *idxd;
42d279f9137ab7 Dave Jiang 2020-01-21 75 struct idxd_wq *wq;
42d279f9137ab7 Dave Jiang 2020-01-21 76 struct device *dev;
26b4f2328e66ce Nikhil Rao 2020-06-15 77 int rc;
42d279f9137ab7 Dave Jiang 2020-01-21 78
42d279f9137ab7 Dave Jiang 2020-01-21 79 wq = inode_wq(inode);
42d279f9137ab7 Dave Jiang 2020-01-21 80 idxd = wq->idxd;
42d279f9137ab7 Dave Jiang 2020-01-21 81 dev = &idxd->pdev->dev;
42d279f9137ab7 Dave Jiang 2020-01-21 82
988aad2f111c76 Dave Jiang 2020-03-12 83 dev_dbg(dev, "%s called: %d\n", __func__, idxd_wq_refcount(wq));
42d279f9137ab7 Dave Jiang 2020-01-21 84
26b4f2328e66ce Nikhil Rao 2020-06-15 85 mutex_lock(&wq->wq_lock);
26b4f2328e66ce Nikhil Rao 2020-06-15 86
26b4f2328e66ce Nikhil Rao 2020-06-15 87 if (idxd_wq_refcount(wq) > 0 && wq_dedicated(wq)) {
26b4f2328e66ce Nikhil Rao 2020-06-15 88 rc = -EBUSY;
26b4f2328e66ce Nikhil Rao 2020-06-15 89 goto failed;
^^^^^^^^^^^
26b4f2328e66ce Nikhil Rao 2020-06-15 90 }
42d279f9137ab7 Dave Jiang 2020-01-21 91
42d279f9137ab7 Dave Jiang 2020-01-21 92 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
It's probably better for performance to move this allocation outside the
lock anyway.
int rc = 0;
...
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
if (!ctx)
return -ENOMEM;
mutex_lock(&wq->wq_lock);
if (idxd_wq_refcount(wq) > 0 && wq_dedicated(wq)) {
rc = -EBUSY;
goto unlock;
}
...
unlock:
mutex_unlock(&wq->wq_lock);
return rc;
26b4f2328e66ce Nikhil Rao 2020-06-15 93 if (!ctx) {
26b4f2328e66ce Nikhil Rao 2020-06-15 94 rc = -ENOMEM;
26b4f2328e66ce Nikhil Rao 2020-06-15 95 goto failed;
26b4f2328e66ce Nikhil Rao 2020-06-15 96 }
42d279f9137ab7 Dave Jiang 2020-01-21 97
42d279f9137ab7 Dave Jiang 2020-01-21 98 ctx->wq = wq;
42d279f9137ab7 Dave Jiang 2020-01-21 99 filp->private_data = ctx;
42d279f9137ab7 Dave Jiang 2020-01-21 100 idxd_wq_get(wq);
26b4f2328e66ce Nikhil Rao 2020-06-15 101 mutex_unlock(&wq->wq_lock);
42d279f9137ab7 Dave Jiang 2020-01-21 102 return 0;
26b4f2328e66ce Nikhil Rao 2020-06-15 103
26b4f2328e66ce Nikhil Rao 2020-06-15 104 failed:
26b4f2328e66ce Nikhil Rao 2020-06-15 105 mutex_unlock(&wq->wq_lock);
26b4f2328e66ce Nikhil Rao 2020-06-15 @106 kfree(ctx);
^^^^^^^^^
Uninitialized.
26b4f2328e66ce Nikhil Rao 2020-06-15 107 return rc;
42d279f9137ab7 Dave Jiang 2020-01-21 108 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32004 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH] dmaengine: idxd: fix cdev locking for open and release
Date: Mon, 22 Jun 2020 14:59:51 +0300 [thread overview]
Message-ID: <20200622115951.GC4151@kadam> (raw)
In-Reply-To: <159225445529.68253.775183898115820961.stgit@djiang5-desk3.ch.intel.com>
[-- Attachment #1: Type: text/plain, Size: 4088 bytes --]
Hi Dave,
url: https://github.com/0day-ci/linux/commits/Dave-Jiang/dmaengine-idxd-fix-cdev-locking-for-open-and-release/20200616-045722
base: https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/slave-dma.git next
config: x86_64-randconfig-m001-20200620 (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:
drivers/dma/idxd/cdev.c:106 idxd_cdev_open() error: uninitialized symbol 'ctx'.
# https://github.com/0day-ci/linux/commit/26b4f2328e66ceefd1ef3be3bea9217d1b7cdda1
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 26b4f2328e66ceefd1ef3be3bea9217d1b7cdda1
vim +/ctx +106 drivers/dma/idxd/cdev.c
42d279f9137ab7 Dave Jiang 2020-01-21 70
42d279f9137ab7 Dave Jiang 2020-01-21 71 static int idxd_cdev_open(struct inode *inode, struct file *filp)
42d279f9137ab7 Dave Jiang 2020-01-21 72 {
42d279f9137ab7 Dave Jiang 2020-01-21 73 struct idxd_user_context *ctx;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42d279f9137ab7 Dave Jiang 2020-01-21 74 struct idxd_device *idxd;
42d279f9137ab7 Dave Jiang 2020-01-21 75 struct idxd_wq *wq;
42d279f9137ab7 Dave Jiang 2020-01-21 76 struct device *dev;
26b4f2328e66ce Nikhil Rao 2020-06-15 77 int rc;
42d279f9137ab7 Dave Jiang 2020-01-21 78
42d279f9137ab7 Dave Jiang 2020-01-21 79 wq = inode_wq(inode);
42d279f9137ab7 Dave Jiang 2020-01-21 80 idxd = wq->idxd;
42d279f9137ab7 Dave Jiang 2020-01-21 81 dev = &idxd->pdev->dev;
42d279f9137ab7 Dave Jiang 2020-01-21 82
988aad2f111c76 Dave Jiang 2020-03-12 83 dev_dbg(dev, "%s called: %d\n", __func__, idxd_wq_refcount(wq));
42d279f9137ab7 Dave Jiang 2020-01-21 84
26b4f2328e66ce Nikhil Rao 2020-06-15 85 mutex_lock(&wq->wq_lock);
26b4f2328e66ce Nikhil Rao 2020-06-15 86
26b4f2328e66ce Nikhil Rao 2020-06-15 87 if (idxd_wq_refcount(wq) > 0 && wq_dedicated(wq)) {
26b4f2328e66ce Nikhil Rao 2020-06-15 88 rc = -EBUSY;
26b4f2328e66ce Nikhil Rao 2020-06-15 89 goto failed;
^^^^^^^^^^^
26b4f2328e66ce Nikhil Rao 2020-06-15 90 }
42d279f9137ab7 Dave Jiang 2020-01-21 91
42d279f9137ab7 Dave Jiang 2020-01-21 92 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
It's probably better for performance to move this allocation outside the
lock anyway.
int rc = 0;
...
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
if (!ctx)
return -ENOMEM;
mutex_lock(&wq->wq_lock);
if (idxd_wq_refcount(wq) > 0 && wq_dedicated(wq)) {
rc = -EBUSY;
goto unlock;
}
...
unlock:
mutex_unlock(&wq->wq_lock);
return rc;
26b4f2328e66ce Nikhil Rao 2020-06-15 93 if (!ctx) {
26b4f2328e66ce Nikhil Rao 2020-06-15 94 rc = -ENOMEM;
26b4f2328e66ce Nikhil Rao 2020-06-15 95 goto failed;
26b4f2328e66ce Nikhil Rao 2020-06-15 96 }
42d279f9137ab7 Dave Jiang 2020-01-21 97
42d279f9137ab7 Dave Jiang 2020-01-21 98 ctx->wq = wq;
42d279f9137ab7 Dave Jiang 2020-01-21 99 filp->private_data = ctx;
42d279f9137ab7 Dave Jiang 2020-01-21 100 idxd_wq_get(wq);
26b4f2328e66ce Nikhil Rao 2020-06-15 101 mutex_unlock(&wq->wq_lock);
42d279f9137ab7 Dave Jiang 2020-01-21 102 return 0;
26b4f2328e66ce Nikhil Rao 2020-06-15 103
26b4f2328e66ce Nikhil Rao 2020-06-15 104 failed:
26b4f2328e66ce Nikhil Rao 2020-06-15 105 mutex_unlock(&wq->wq_lock);
26b4f2328e66ce Nikhil Rao 2020-06-15 @106 kfree(ctx);
^^^^^^^^^
Uninitialized.
26b4f2328e66ce Nikhil Rao 2020-06-15 107 return rc;
42d279f9137ab7 Dave Jiang 2020-01-21 108 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32004 bytes --]
next prev parent reply other threads:[~2020-06-22 12:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-15 20:54 [PATCH] dmaengine: idxd: fix cdev locking for open and release Dave Jiang
2020-06-22 11:59 ` Dan Carpenter [this message]
2020-06-22 11:59 ` Dan Carpenter
2020-06-22 11:59 ` Dan Carpenter
-- strict thread matches above, loose matches on Subject: below --
2020-06-21 2:12 kernel test robot
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=20200622115951.GC4151@kadam \
--to=dan.carpenter@oracle.com \
--cc=dave.jiang@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=kbuild-all@lists.01.org \
--cc=kbuild@lists.01.org \
--cc=lkp@intel.com \
--cc=nikhil.rao@intel.com \
--cc=vkoul@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.