From: Dan Carpenter <dan.carpenter@oracle.com>
To: Hui Wang <hui.wang@canonical.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [bug report] ALSA: hda - Don't register a cb func if it is registered already
Date: Wed, 21 Oct 2020 20:27:28 +0300 [thread overview]
Message-ID: <20201021172728.GY18329@kadam> (raw)
In-Reply-To: <9be5bc31-0118-1542-560f-cfe2cecf2403@canonical.com>
On Wed, Oct 21, 2020 at 11:03:11PM +0800, Hui Wang wrote:
> Looks like this will not bring problem on patch_sigmatel.c, NULL and valid
> kernel pointer are same for IS_ERR(), they will not make IS_ERR() come true.
>
Correct, but that is the problem. You can dereference a valid pointer
but you can't dereference a NULL.
> On 10/21/20 10:21 PM, Hui Wang wrote:
> >
> > On 10/21/20 8:19 PM, Dan Carpenter wrote:
> > > Hello Hui Wang,
> > >
> > > The patch f4794c6064a8: "ALSA: hda - Don't register a cb func if it
> > > is registered already" from Sep 30, 2020, leads to the following
> > > static checker warning:
> > >
> > > sound/pci/hda/patch_sigmatel.c:3075 stac92hd71bxx_fixup_hp_m4()
> > > warn: 'jack' can also be NULL
> > >
> > > sound/pci/hda/patch_sigmatel.c
> > > 3069 /* Enable VREF power saving on GPIO1 detect */
> > > 3070 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
> > > 3071 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02);
> > > 3072 jack = snd_hda_jack_detect_enable_callback(codec,
> > > codec->core.afg,
> > > 3073 stac_vref_event);
> > >
> > > Originally snd_hda_jack_detect_enable_callback() would not return NULL
> > > here.
> > >
> > > 3074 if (!IS_ERR(jack))
> > > 3075 jack->private_data = 0x02;
So if "jack" is NULL then it will say it's not an error pointer so it
will try to assign jack->private_data = 0x02; and oops.
regards,
dan carpenter
next prev parent reply other threads:[~2020-10-21 17:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-21 12:19 [bug report] ALSA: hda - Don't register a cb func if it is registered already Dan Carpenter
2020-10-21 14:21 ` Hui Wang
2020-10-21 15:03 ` Hui Wang
2020-10-21 15:59 ` Takashi Iwai
2020-10-22 1:45 ` Hui Wang
2020-10-21 17:27 ` Dan Carpenter [this message]
2020-10-22 1:42 ` Hui Wang
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=20201021172728.GY18329@kadam \
--to=dan.carpenter@oracle.com \
--cc=alsa-devel@alsa-project.org \
--cc=hui.wang@canonical.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox