From: walter harms <wharms@bfs.de>
To: kernel-janitors@vger.kernel.org
Subject: Re: sound/pci/hda/patch_ca0132.c: potential null dereference 'dma_engine'
Date: Fri, 21 Sep 2012 11:47:54 +0000 [thread overview]
Message-ID: <505C53EA.2090206@bfs.de> (raw)
In-Reply-To: <20120921102242.GA11865@localhost>
Am 21.09.2012 13:46, schrieb Takashi Iwai:
> At Fri, 21 Sep 2012 18:22:42 +0800,
> Fengguang Wu wrote:
>>
>> Hi Ian,
>>
>> FYI, there are new smatch warnings show up in
>>
>> commit 0b37d4c7982442730061a737c16939e8cc363861
>> Author: Ian Minett <ian_minett@creativelabs.com>
>> Commit: Takashi Iwai <tiwai@suse.de>
>> CommitDate: Fri Sep 21 09:54:29 2012 +0200
>>
>> + sound/pci/hda/patch_ca0132.c:2056 dspxfr_image() error: potential null dereference 'dma_engine'. (kzalloc returns null)
>> + sound/pci/hda/patch_ca0132.c:2056 dspxfr_image() error: we previously assumed 'dma_engine' could be null (see line 1963)
>
> Fixed with the patch below. Thanks!
>
>
> Takashi
>
> => Subject: [PATCH] ALSA: hda - Fix NULL dereference in error path of patch_ca0132.c
>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
> sound/pci/hda/patch_ca0132.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
> index 5c6a056..03f57c9 100644
> --- a/sound/pci/hda/patch_ca0132.c
> +++ b/sound/pci/hda/patch_ca0132.c
> @@ -1960,10 +1960,8 @@ static int dspxfr_image(struct hda_codec *codec,
> return -EINVAL;
>
> dma_engine = kzalloc(sizeof(*dma_engine), GFP_KERNEL);
> - if (!dma_engine) {
> - status = -ENOMEM;
> - goto exit;
> - }
> + if (!dma_engine)
> + return -ENOMEM;
> memset((void *)dma_engine, 0, sizeof(*dma_engine));
>
Why do you need that memset() ? kzalloc() should fill the buffer with 0.
re,
wh
> dma_engine->dmab = kzalloc(sizeof(*dma_engine->dmab), GFP_KERNEL);
next prev parent reply other threads:[~2012-09-21 11:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-21 10:22 sound/pci/hda/patch_ca0132.c: potential null dereference 'dma_engine' Fengguang Wu
2012-09-21 10:22 ` Fengguang Wu
2012-09-21 11:46 ` Takashi Iwai
2012-09-21 11:46 ` Takashi Iwai
2012-09-27 2:34 ` Ian Minett
2012-09-21 11:47 ` walter harms [this message]
2012-09-21 12:00 ` Takashi Iwai
2012-09-21 12:00 ` Takashi Iwai
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=505C53EA.2090206@bfs.de \
--to=wharms@bfs.de \
--cc=kernel-janitors@vger.kernel.org \
/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 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.