All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of
@ 2015-03-03 13:14 Vishal Thanki
  2015-03-03 13:18   ` Lars-Peter Clausen
  0 siblings, 1 reply; 14+ messages in thread
From: Vishal Thanki @ 2015-03-03 13:14 UTC (permalink / raw)
  To: kernel-janitors, alsa-devel, broonie, lgirdwood

Make sure devm_kzalloc() succeeds.

Signed-off-by: Vishal Thanki <vishalthanki@gmail.com>

diff --git a/sound/soc/generic/simple-card.c
b/sound/soc/generic/simple-card.c
index f7c6734..fb550b5 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -372,6 +372,11 @@ static int asoc_simple_card_dai_link_of(struct
device_node *node,
     strlen(dai_link->cpu_dai_name)   +
     strlen(dai_link->codec_dai_name) + 2,
     GFP_KERNEL);
+ if (!name) {
+ ret = -ENOMEM;
+ goto dai_link_of_err;
+ }
+
  sprintf(name, "%s-%s", dai_link->cpu_dai_name,
  dai_link->codec_dai_name);
  dai_link->name = dai_link->stream_name = name;
--

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

* Re: [alsa-devel] [PATCH] ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of
  2015-03-03 13:14 [PATCH] ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of Vishal Thanki
@ 2015-03-03 13:18   ` Lars-Peter Clausen
  0 siblings, 0 replies; 14+ messages in thread
From: Lars-Peter Clausen @ 2015-03-03 13:18 UTC (permalink / raw)
  To: vishal.thanki, kernel-janitors, alsa-devel, broonie, lgirdwood

On 03/03/2015 02:14 PM, Vishal Thanki wrote:
[...]
> + if (!name) {
> + ret = -ENOMEM;
> + goto dai_link_of_err;
> + }
> +

The indention here is broken.


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

* Re: [alsa-devel] [PATCH] ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of
@ 2015-03-03 13:18   ` Lars-Peter Clausen
  0 siblings, 0 replies; 14+ messages in thread
From: Lars-Peter Clausen @ 2015-03-03 13:18 UTC (permalink / raw)
  To: vishal.thanki, kernel-janitors, alsa-devel, broonie, lgirdwood

On 03/03/2015 02:14 PM, Vishal Thanki wrote:
[...]
> + if (!name) {
> + ret = -ENOMEM;
> + goto dai_link_of_err;
> + }
> +

The indention here is broken.


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

* [PATCH] ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of
  2015-03-03 13:18   ` Lars-Peter Clausen
@ 2015-03-03 13:41 ` Vishal Thanki
  -1 siblings, 0 replies; 14+ messages in thread
From: Vishal Thanki @ 2015-03-03 13:29 UTC (permalink / raw)
  To: kernel-janitors, alsa-devel, broonie, lgirdwood

Make sure devm_kzalloc() succeeds.

Signed-off-by: Vishal Thanki <vishalthanki@gmail.com>
---
 sound/soc/generic/simple-card.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index f7c6734..fb550b5 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -372,6 +372,11 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 			    strlen(dai_link->cpu_dai_name)   +
 			    strlen(dai_link->codec_dai_name) + 2,
 			    GFP_KERNEL);
+	if (!name) {
+		ret = -ENOMEM;
+		goto dai_link_of_err;
+	}
+
 	sprintf(name, "%s-%s", dai_link->cpu_dai_name,
 				dai_link->codec_dai_name);
 	dai_link->name = dai_link->stream_name = name;
-- 
1.7.9.5


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

* [PATCH] ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of
@ 2015-03-03 13:41 ` Vishal Thanki
  0 siblings, 0 replies; 14+ messages in thread
From: Vishal Thanki @ 2015-03-03 13:41 UTC (permalink / raw)
  To: kernel-janitors, alsa-devel, broonie, lgirdwood

Make sure devm_kzalloc() succeeds.

Signed-off-by: Vishal Thanki <vishalthanki@gmail.com>
---
 sound/soc/generic/simple-card.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index f7c6734..fb550b5 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -372,6 +372,11 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 			    strlen(dai_link->cpu_dai_name)   +
 			    strlen(dai_link->codec_dai_name) + 2,
 			    GFP_KERNEL);
+	if (!name) {
+		ret = -ENOMEM;
+		goto dai_link_of_err;
+	}
+
 	sprintf(name, "%s-%s", dai_link->cpu_dai_name,
 				dai_link->codec_dai_name);
 	dai_link->name = dai_link->stream_name = name;
-- 
1.7.9.5


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

* Re: [PATCH] ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of
  2015-03-03 13:41 ` Vishal Thanki
@ 2015-03-03 14:25   ` Mark Brown
  -1 siblings, 0 replies; 14+ messages in thread
From: Mark Brown @ 2015-03-03 14:25 UTC (permalink / raw)
  To: Vishal Thanki; +Cc: alsa-devel, kernel-janitors, lgirdwood

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

On Tue, Mar 03, 2015 at 06:59:00PM +0530, Vishal Thanki wrote:
> Make sure devm_kzalloc() succeeds.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH] ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of
@ 2015-03-03 14:25   ` Mark Brown
  0 siblings, 0 replies; 14+ messages in thread
From: Mark Brown @ 2015-03-03 14:25 UTC (permalink / raw)
  To: Vishal Thanki; +Cc: alsa-devel, kernel-janitors, lgirdwood


[-- Attachment #1.1: Type: text/plain, Size: 118 bytes --]

On Tue, Mar 03, 2015 at 06:59:00PM +0530, Vishal Thanki wrote:
> Make sure devm_kzalloc() succeeds.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* Re: [PATCH] ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of
  2015-03-03 13:41 ` Vishal Thanki
@ 2015-03-04 20:29   ` walter harms
  -1 siblings, 0 replies; 14+ messages in thread
From: walter harms @ 2015-03-04 20:29 UTC (permalink / raw)
  To: Vishal Thanki; +Cc: kernel-janitors, alsa-devel, broonie, lgirdwood



Am 03.03.2015 14:29, schrieb Vishal Thanki:
> Make sure devm_kzalloc() succeeds.
> 
> Signed-off-by: Vishal Thanki <vishalthanki@gmail.com>
> ---
>  sound/soc/generic/simple-card.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
> index f7c6734..fb550b5 100644
> --- a/sound/soc/generic/simple-card.c
> +++ b/sound/soc/generic/simple-card.c
> @@ -372,6 +372,11 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
>  			    strlen(dai_link->cpu_dai_name)   +
>  			    strlen(dai_link->codec_dai_name) + 2,
>  			    GFP_KERNEL);
> +	if (!name) {
> +		ret = -ENOMEM;
> +		goto dai_link_of_err;
> +	}
> +
>  	sprintf(name, "%s-%s", dai_link->cpu_dai_name,
>  				dai_link->codec_dai_name);
>  	dai_link->name = dai_link->stream_name = name;


maybe it is more simple to use kasprintf here ?

just my 2 cents,
wh


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

* Re: [PATCH] ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of
@ 2015-03-04 20:29   ` walter harms
  0 siblings, 0 replies; 14+ messages in thread
From: walter harms @ 2015-03-04 20:29 UTC (permalink / raw)
  To: Vishal Thanki; +Cc: kernel-janitors, alsa-devel, broonie, lgirdwood



Am 03.03.2015 14:29, schrieb Vishal Thanki:
> Make sure devm_kzalloc() succeeds.
> 
> Signed-off-by: Vishal Thanki <vishalthanki@gmail.com>
> ---
>  sound/soc/generic/simple-card.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
> index f7c6734..fb550b5 100644
> --- a/sound/soc/generic/simple-card.c
> +++ b/sound/soc/generic/simple-card.c
> @@ -372,6 +372,11 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
>  			    strlen(dai_link->cpu_dai_name)   +
>  			    strlen(dai_link->codec_dai_name) + 2,
>  			    GFP_KERNEL);
> +	if (!name) {
> +		ret = -ENOMEM;
> +		goto dai_link_of_err;
> +	}
> +
>  	sprintf(name, "%s-%s", dai_link->cpu_dai_name,
>  				dai_link->codec_dai_name);
>  	dai_link->name = dai_link->stream_name = name;


maybe it is more simple to use kasprintf here ?

just my 2 cents,
wh


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

* Re: [PATCH] ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of
  2015-03-04 20:29   ` walter harms
  (?)
@ 2015-03-05 10:45   ` Vishal Thanki
  2015-03-05 12:03       ` Lars-Peter Clausen
  -1 siblings, 1 reply; 14+ messages in thread
From: Vishal Thanki @ 2015-03-05 10:45 UTC (permalink / raw)
  To: wharms; +Cc: alsa-devel, broonie, kernel-janitors, Liam Girdwood

I am new to kasprintf. I think we need to make sure of freeing memory
allocated using kasprintf.

On Thu, Mar 5, 2015 at 1:59 AM, walter harms <wharms@bfs.de> wrote:

>
>
> Am 03.03.2015 14:29, schrieb Vishal Thanki:
> > Make sure devm_kzalloc() succeeds.
> >
> > Signed-off-by: Vishal Thanki <vishalthanki@gmail.com>
> > ---
> >  sound/soc/generic/simple-card.c |    5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/sound/soc/generic/simple-card.c
> b/sound/soc/generic/simple-card.c
> > index f7c6734..fb550b5 100644
> > --- a/sound/soc/generic/simple-card.c
> > +++ b/sound/soc/generic/simple-card.c
> > @@ -372,6 +372,11 @@ static int asoc_simple_card_dai_link_of(struct
> device_node *node,
> >                           strlen(dai_link->cpu_dai_name)   +
> >                           strlen(dai_link->codec_dai_name) + 2,
> >                           GFP_KERNEL);
> > +     if (!name) {
> > +             ret = -ENOMEM;
> > +             goto dai_link_of_err;
> > +     }
> > +
> >       sprintf(name, "%s-%s", dai_link->cpu_dai_name,
> >                               dai_link->codec_dai_name);
> >       dai_link->name = dai_link->stream_name = name;
>
>
> maybe it is more simple to use kasprintf here ?
>
> just my 2 cents,
> wh
>
>

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

* Re: [alsa-devel] [PATCH] ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of
  2015-03-05 10:45   ` Vishal Thanki
@ 2015-03-05 12:03       ` Lars-Peter Clausen
  0 siblings, 0 replies; 14+ messages in thread
From: Lars-Peter Clausen @ 2015-03-05 12:03 UTC (permalink / raw)
  To: vishal.thanki, wharms; +Cc: alsa-devel, broonie, kernel-janitors, Liam Girdwood

On 03/05/2015 11:45 AM, Vishal Thanki wrote:
> I am new to kasprintf. I think we need to make sure of freeing memory
> allocated using kasprintf.

There is also devm_kasprintf().

But these are really two separate things. One thing is the missing NULL 
check, which is a bug fix and is fixed by your patch. The other thing is the 
conversion to kasprintf() which is a code cleanup and should be done in a 
separate patch.

- Lars


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

* Re: [alsa-devel] [PATCH] ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of
@ 2015-03-05 12:03       ` Lars-Peter Clausen
  0 siblings, 0 replies; 14+ messages in thread
From: Lars-Peter Clausen @ 2015-03-05 12:03 UTC (permalink / raw)
  To: vishal.thanki, wharms; +Cc: alsa-devel, broonie, kernel-janitors, Liam Girdwood

On 03/05/2015 11:45 AM, Vishal Thanki wrote:
> I am new to kasprintf. I think we need to make sure of freeing memory
> allocated using kasprintf.

There is also devm_kasprintf().

But these are really two separate things. One thing is the missing NULL 
check, which is a bug fix and is fixed by your patch. The other thing is the 
conversion to kasprintf() which is a code cleanup and should be done in a 
separate patch.

- Lars


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

* Re: [alsa-devel] [PATCH] ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of
  2015-03-05 12:03       ` Lars-Peter Clausen
@ 2015-03-05 19:35         ` walter harms
  -1 siblings, 0 replies; 14+ messages in thread
From: walter harms @ 2015-03-05 19:35 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: vishal.thanki, alsa-devel, broonie, kernel-janitors, Liam Girdwood



Am 05.03.2015 13:03, schrieb Lars-Peter Clausen:
> On 03/05/2015 11:45 AM, Vishal Thanki wrote:
>> I am new to kasprintf. I think we need to make sure of freeing memory
>> allocated using kasprintf.
> 
> There is also devm_kasprintf().
> 
> But these are really two separate things. One thing is the missing NULL
> check, which is a bug fix and is fixed by your patch. The other thing is
> the conversion to kasprintf() which is a code cleanup and should be done
> in a separate patch.
> 

hi,
thx for the hint:
never read about  devm_kasprintf().

ntl my mail was intended as hint about asprintf() not about the patch.

re,
 wh

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

* Re: [alsa-devel] [PATCH] ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of
@ 2015-03-05 19:35         ` walter harms
  0 siblings, 0 replies; 14+ messages in thread
From: walter harms @ 2015-03-05 19:35 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: vishal.thanki, alsa-devel, broonie, kernel-janitors, Liam Girdwood



Am 05.03.2015 13:03, schrieb Lars-Peter Clausen:
> On 03/05/2015 11:45 AM, Vishal Thanki wrote:
>> I am new to kasprintf. I think we need to make sure of freeing memory
>> allocated using kasprintf.
> 
> There is also devm_kasprintf().
> 
> But these are really two separate things. One thing is the missing NULL
> check, which is a bug fix and is fixed by your patch. The other thing is
> the conversion to kasprintf() which is a code cleanup and should be done
> in a separate patch.
> 

hi,
thx for the hint:
never read about  devm_kasprintf().

ntl my mail was intended as hint about asprintf() not about the patch.

re,
 wh

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

end of thread, other threads:[~2015-03-05 19:35 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-03 13:14 [PATCH] ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of Vishal Thanki
2015-03-03 13:18 ` [alsa-devel] " Lars-Peter Clausen
2015-03-03 13:18   ` Lars-Peter Clausen
2015-03-03 13:29 Vishal Thanki
2015-03-03 13:41 ` Vishal Thanki
2015-03-03 14:25 ` Mark Brown
2015-03-03 14:25   ` Mark Brown
2015-03-04 20:29 ` walter harms
2015-03-04 20:29   ` walter harms
2015-03-05 10:45   ` Vishal Thanki
2015-03-05 12:03     ` [alsa-devel] " Lars-Peter Clausen
2015-03-05 12:03       ` Lars-Peter Clausen
2015-03-05 19:35       ` walter harms
2015-03-05 19:35         ` walter harms

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.