[alsa-devel] sound/pci/hda/patch_ca0132.c: potential null dereference 'dma_engine'
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)
--- 0-DAY kernel build testing backend Open Source Technology Centre Fengguang Wu, Yuanhan Liu Intel Corporation
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));
dma_engine->dmab = kzalloc(sizeof(*dma_engine->dmab), GFP_KERNEL);
FYI, there are new smatch warnings show up in
- 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)
Thank you for catching these warnings, and to Takashi for patching them! It's greatly appreciated.
- Ian
participants (3)
-
Fengguang Wu
-
Ian Minett
-
Takashi Iwai