kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [alsa-devel] [PATCH] ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of
       [not found] <CAC3a_SBrJxS6x+qCwi0p5DcbEbVFX3AOP=-NxWbugY6bEvirLg@mail.gmail.com>
@ 2015-03-03 13:18 ` Lars-Peter Clausen
  2015-03-03 13:41   ` Vishal Thanki
  0 siblings, 1 reply; 6+ 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] 6+ messages in thread

* [PATCH] ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of
  2015-03-03 13:18 ` [alsa-devel] [PATCH] ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of Lars-Peter Clausen
@ 2015-03-03 13:41   ` Vishal Thanki
  2015-03-03 14:25     ` Mark Brown
  2015-03-04 20:29     ` walter harms
  0 siblings, 2 replies; 6+ 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] 6+ 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
  2015-03-04 20:29     ` walter harms
  1 sibling, 0 replies; 6+ 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] 6+ 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
@ 2015-03-04 20:29     ` walter harms
       [not found]       ` <CAC3a_SDWqGLsgUu8_mRYkW=Y+KHvWvAWjUYr4Ba3BrDBiP6nNA@mail.gmail.com>
  1 sibling, 1 reply; 6+ 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] 6+ messages in thread

* Re: [alsa-devel] [PATCH] ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of
       [not found]       ` <CAC3a_SDWqGLsgUu8_mRYkW=Y+KHvWvAWjUYr4Ba3BrDBiP6nNA@mail.gmail.com>
@ 2015-03-05 12:03         ` Lars-Peter Clausen
  2015-03-05 19:35           ` walter harms
  0 siblings, 1 reply; 6+ 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] 6+ 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         ` [alsa-devel] " Lars-Peter Clausen
@ 2015-03-05 19:35           ` walter harms
  0 siblings, 0 replies; 6+ 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] 6+ messages in thread

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

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CAC3a_SBrJxS6x+qCwi0p5DcbEbVFX3AOP=-NxWbugY6bEvirLg@mail.gmail.com>
2015-03-03 13:18 ` [alsa-devel] [PATCH] ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of Lars-Peter Clausen
2015-03-03 13:41   ` Vishal Thanki
2015-03-03 14:25     ` Mark Brown
2015-03-04 20:29     ` walter harms
     [not found]       ` <CAC3a_SDWqGLsgUu8_mRYkW=Y+KHvWvAWjUYr4Ba3BrDBiP6nNA@mail.gmail.com>
2015-03-05 12:03         ` [alsa-devel] " Lars-Peter Clausen
2015-03-05 19:35           ` walter harms

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