LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [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	[flat|nested] 6+ messages in thread

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

On Thu, May 30, 2019 at 09:19:20AM +0800, Gen Zhang wrote:
> 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;
>  
> ---
Can anyone look into this patch? It's acked by Thierry Reding 
<treding@nvidia.com>.

Thanks
Gen

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

* Re: [PATCH] tegra-hsp: fix a missing-check bug in tegra_hsp_doorbell_create()
  2019-06-08 16:11 ` Gen Zhang
@ 2019-06-17  9:23   ` Gen Zhang
  0 siblings, 0 replies; 6+ messages in thread
From: Gen Zhang @ 2019-06-17  9:23 UTC (permalink / raw)
  To: jassisinghbrar; +Cc: thierry.reding, linux-kernel, linux-tegra

On Sun, Jun 09, 2019 at 12:11:44AM +0800, Gen Zhang wrote:
> On Thu, May 30, 2019 at 09:19:20AM +0800, Gen Zhang wrote:
> > 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;
> >  
> > ---
> Can anyone look into this patch? It's acked by Thierry Reding 
> <treding@nvidia.com>.
> 
> Thanks
> Gen
Could anyone look into this patch? It's not updated for about 20 days.
And I am really on a deadline to get this patch applied.

Thanks
Gen

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

* Re: [PATCH] tegra-hsp: fix a missing-check bug in tegra_hsp_doorbell_create()
  2019-05-27 14:05 ` Thierry Reding
@ 2019-05-27 14:10   ` Gen Zhang
  0 siblings, 0 replies; 6+ messages in thread
From: Gen Zhang @ 2019-05-27 14:10 UTC (permalink / raw)
  To: Thierry Reding; +Cc: jassisinghbrar, linux-kernel, linux-tegra

On Mon, May 27, 2019 at 04:05:49PM +0200, Thierry Reding wrote:
> On Mon, May 27, 2019 at 09:04:30PM +0800, Gen Zhang wrote:
> > 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);
> 
> I don't think this could ever happen, since name is always from .rodata
> and hence devm_kstrdup_const() never returns NULL. But formally this is
> correct, so:
> 
> Acked-by: Thierry Reding <treding@nvidia.com>
Thanks for your reply, Thierry.

Thanks
Gen

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

* Re: [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
  2019-05-27 14:10   ` Gen Zhang
  0 siblings, 1 reply; 6+ messages in thread
From: Thierry Reding @ 2019-05-27 14:05 UTC (permalink / raw)
  To: Gen Zhang; +Cc: jassisinghbrar, linux-kernel, linux-tegra

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

On Mon, May 27, 2019 at 09:04:30PM +0800, Gen Zhang wrote:
> 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);

I don't think this could ever happen, since name is always from .rodata
and hence devm_kstrdup_const() never returns NULL. But formally this is
correct, so:

Acked-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* [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	[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-30  1:19 [PATCH] tegra-hsp: fix a missing-check bug in tegra_hsp_doorbell_create() Gen Zhang
2019-06-08 16:11 ` 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

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