diff options
author | Takashi Iwai <tiwai@suse.de> | 2013-01-15 11:42:15 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-01-15 11:42:15 -0500 |
commit | 549e8292a1e7712d401cc8b8df88286cdfff9f08 (patch) | |
tree | 76d2f9968b38a15d308d5db040a6378a7f09fad6 /sound/pci/hda | |
parent | 425a7880e804f6147b520aecee522e4172c98e83 (diff) |
ALSA: hda/ca0132 - Fix possible NULL dereference
Spotted by smatch,
sound/pci/hda/patch_ca0132.c:1950 dspxfr_image() error: potential
null dereference 'dma_engine'. (kzalloc returns null)
sound/pci/hda/patch_ca0132.c:1950 dspxfr_image() error: we
previously assumed 'dma_engine' could be null (see line 1857)
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r-- | sound/pci/hda/patch_ca0132.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c index f6c949039cab..ee2b9c6600ff 100644 --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c | |||
@@ -2416,15 +2416,13 @@ static int dspxfr_image(struct hda_codec *codec, | |||
2416 | return -EINVAL; | 2416 | return -EINVAL; |
2417 | 2417 | ||
2418 | dma_engine = kzalloc(sizeof(*dma_engine), GFP_KERNEL); | 2418 | dma_engine = kzalloc(sizeof(*dma_engine), GFP_KERNEL); |
2419 | if (!dma_engine) { | 2419 | if (!dma_engine) |
2420 | status = -ENOMEM; | 2420 | return -ENOMEM; |
2421 | goto exit; | ||
2422 | } | ||
2423 | 2421 | ||
2424 | dma_engine->dmab = kzalloc(sizeof(*dma_engine->dmab), GFP_KERNEL); | 2422 | dma_engine->dmab = kzalloc(sizeof(*dma_engine->dmab), GFP_KERNEL); |
2425 | if (!dma_engine->dmab) { | 2423 | if (!dma_engine->dmab) { |
2426 | status = -ENOMEM; | 2424 | kfree(dma_engine); |
2427 | goto exit; | 2425 | return -ENOMEM; |
2428 | } | 2426 | } |
2429 | 2427 | ||
2430 | dma_engine->codec = codec; | 2428 | dma_engine->codec = codec; |