From: Dave Jiang <dave.jiang@intel.com>
To: Ziming Du <duziming2@huawei.com>, dmaengine@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, vkoul@kernel.org,
vinicius.gomes@intel.com, liuyongqiang13@huawei.com
Subject: Re: [PATCH next] dmaengine: idxd: init: Fix uninitialized use of conf_dev in idxd_setup_wqs()
Date: Mon, 28 Jul 2025 07:56:39 -0700 [thread overview]
Message-ID: <9539bae4-dedf-4495-bd6d-5a6120362250@intel.com> (raw)
In-Reply-To: <20250728115128.50889-1-duziming2@huawei.com>
On 7/28/25 4:51 AM, Ziming Du wrote:
> Fix Smatch-detected issue:
> drivers/dma/idxd/init.c:246 idxd_setup_wqs() error:
> uninitialized symbol'conf_dev'
>
> 'conf_dev' may be used uninitialized in error handling paths.
> Specifically, if the memory allocation for 'wq' fails, the code
> jumps to 'err', and attempt to call put_device(conf_dev), without
> ensuring that conf_dev has been properly initialized.
>
> Fix it by initializing conf_dev to NULL at declaration.
>
> Signed-off-by: Ziming Du <duziming2@huawei.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
> drivers/dma/idxd/init.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c
> index 35bdefd3728b..2b61f26af1f6 100644
> --- a/drivers/dma/idxd/init.c
> +++ b/drivers/dma/idxd/init.c
> @@ -178,7 +178,7 @@ static int idxd_setup_wqs(struct idxd_device *idxd)
> {
> struct device *dev = &idxd->pdev->dev;
> struct idxd_wq *wq;
> - struct device *conf_dev;
> + struct device *conf_dev = NULL;
> int i, rc;
>
> idxd->wqs = kcalloc_node(idxd->max_wqs, sizeof(struct idxd_wq *),
next prev parent reply other threads:[~2025-07-28 14:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-28 11:51 [PATCH next] dmaengine: idxd: init: Fix uninitialized use of conf_dev in idxd_setup_wqs() Ziming Du
2025-07-28 14:56 ` Dave Jiang [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-07-28 11:36 Ziming Du
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=9539bae4-dedf-4495-bd6d-5a6120362250@intel.com \
--to=dave.jiang@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=duziming2@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyongqiang13@huawei.com \
--cc=vinicius.gomes@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox