From: Gen Zhang <blackgod016574@gmail.com>
To: jassisinghbrar@gmail.com
Cc: thierry.reding@gmail.com, linux-kernel@vger.kernel.org,
linux-tegra@vger.kernel.org
Subject: [PATCH] tegra-hsp: fix a missing-check bug in tegra_hsp_doorbell_create()
Date: Thu, 30 May 2019 09:19:20 +0800 [thread overview]
Message-ID: <20190530011920.GA6490@zhanggen-UX430UQ> (raw)
In tegra_hsp_doorbell_create(), 'db->name' is allocated by
devm_kstrdup_const(). It returns NULL when fails. So 'db->name' should
be checked.
Signed-off-by: Gen Zhang <blackgod016574@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
---
diff --git a/drivers/mailbox/tegra-hsp.c b/drivers/mailbox/tegra-hsp.c
index 11fc9fd..b613c46 100644
--- a/drivers/mailbox/tegra-hsp.c
+++ b/drivers/mailbox/tegra-hsp.c
@@ -292,6 +292,8 @@ tegra_hsp_doorbell_create(struct tegra_hsp *hsp, const char *name,
db->channel.hsp = hsp;
db->name = devm_kstrdup_const(hsp->dev, name, GFP_KERNEL);
+ if (!db->name)
+ return ERR_PTR(-ENOMEM);
db->master = master;
db->index = index;
---
next reply other threads:[~2019-05-30 1:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-30 1:19 Gen Zhang [this message]
2019-06-08 16:11 ` [PATCH] tegra-hsp: fix a missing-check bug in tegra_hsp_doorbell_create() Gen Zhang
2019-06-17 9:23 ` Gen Zhang
-- strict thread matches above, loose matches on Subject: below --
2019-05-27 13:04 Gen Zhang
2019-05-27 14:05 ` Thierry Reding
2019-05-27 14:10 ` Gen Zhang
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=20190530011920.GA6490@zhanggen-UX430UQ \
--to=blackgod016574@gmail.com \
--cc=jassisinghbrar@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=thierry.reding@gmail.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