* sound/pci/hda/patch_ca0132.c: potential null dereference 'dma_engine'
@ 2012-09-21 10:22 Fengguang Wu
2012-09-21 11:46 ` Takashi Iwai
2012-09-21 11:47 ` walter harms
0 siblings, 2 replies; 4+ messages in thread
From: Fengguang Wu @ 2012-09-21 10:22 UTC (permalink / raw)
To: Ian Minett; +Cc: Takashi Iwai, alsa-devel, kernel-janitors
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: sound/pci/hda/patch_ca0132.c: potential null dereference 'dma_engine'
2012-09-21 10:22 sound/pci/hda/patch_ca0132.c: potential null dereference 'dma_engine' Fengguang Wu
@ 2012-09-21 11:46 ` Takashi Iwai
2012-09-21 11:47 ` walter harms
1 sibling, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2012-09-21 11:46 UTC (permalink / raw)
To: Fengguang Wu; +Cc: alsa-devel, kernel-janitors, Ian Minett
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);
--
1.7.11.5
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: sound/pci/hda/patch_ca0132.c: potential null dereference 'dma_engine'
2012-09-21 10:22 sound/pci/hda/patch_ca0132.c: potential null dereference 'dma_engine' Fengguang Wu
2012-09-21 11:46 ` Takashi Iwai
@ 2012-09-21 11:47 ` walter harms
2012-09-21 12:00 ` Takashi Iwai
1 sibling, 1 reply; 4+ messages in thread
From: walter harms @ 2012-09-21 11:47 UTC (permalink / raw)
To: kernel-janitors
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);
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: sound/pci/hda/patch_ca0132.c: potential null dereference 'dma_engine'
2012-09-21 11:47 ` walter harms
@ 2012-09-21 12:00 ` Takashi Iwai
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2012-09-21 12:00 UTC (permalink / raw)
To: wharms; +Cc: alsa-devel, Fengguang Wu, kernel-janitors, Ian Minett
At Fri, 21 Sep 2012 13:47:54 +0200,
walter harms wrote:
>
>
>
> 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.
True.
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-09-21 12:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-21 10:22 sound/pci/hda/patch_ca0132.c: potential null dereference 'dma_engine' Fengguang Wu
2012-09-21 11:46 ` Takashi Iwai
2012-09-21 11:47 ` walter harms
2012-09-21 12:00 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox