linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tegra-hsp: fix a missing-check bug in tegra_hsp_doorbell_create()
@ 2019-05-27 13:04 Gen Zhang
  2019-05-27 14:05 ` Thierry Reding
  0 siblings, 1 reply; 6+ messages in thread
From: Gen Zhang @ 2019-05-27 13:04 UTC (permalink / raw)
  To: jassisinghbrar, thierry.reding; +Cc: linux-kernel, linux-tegra

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>
---
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;
 
---

^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [PATCH] tegra-hsp: fix a missing-check bug in tegra_hsp_doorbell_create()
@ 2019-05-30  1:19 Gen Zhang
  2019-06-08 16:11 ` Gen Zhang
  0 siblings, 1 reply; 6+ messages in thread
From: Gen Zhang @ 2019-05-30  1:19 UTC (permalink / raw)
  To: jassisinghbrar; +Cc: thierry.reding, linux-kernel, linux-tegra

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;
 
---

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-06-17  9:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-27 13:04 [PATCH] tegra-hsp: fix a missing-check bug in tegra_hsp_doorbell_create() Gen Zhang
2019-05-27 14:05 ` Thierry Reding
2019-05-27 14:10   ` Gen Zhang
  -- strict thread matches above, loose matches on Subject: below --
2019-05-30  1:19 Gen Zhang
2019-06-08 16:11 ` Gen Zhang
2019-06-17  9:23   ` Gen Zhang

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).