Re: [bug report] ALSA: hda - Don't register a cb func if it is registered already

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux