Current-Users archive

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

Re: crash with latest audio changes



On Fri, 16 Dec 2016, Christos Zoulas wrote:
audio_get_port+0x7e is this line:
	        return sc->hw_if->get_port(sc->hw_hdl, mc);
I don't see how we can get there with sc->hw_if being NULL..
Add some printfs to see what's NULL...

I've been staring at this in sys/dev/audio.c and trying to learn from this situation. I have some ignorant (because I'm not a kernel coder and only have about 30k lines of C under my belt) questions:

If nobody cares, that's cool. It was just an exercise for me.

* Why not check the input values in au_get_lr_value() ? It appears to
  blindly use the first two input structures without checking if they are
  null. So does au_get_gain() and others. Does that kind of thing slow the
  driver down too much or is the input checked elsewhere before being
  passed?

* Dunno where get_port() comes from but shouldn't it also check it's first
  argument (a struct) for NULL?

* In audio_mixer_capture(), why do this:
  (void)sc->hw_if->get_port(sc->hw_hdl, mc);
  That doesn't appear to do anything other than call a function that reads
  a value. Does it actually assign the value somehow? Is one of those some
  kind of queue that get_port alters after reading ?

* audio_mixer_restore() also blindly uses a audio_softc struct, but is it
  really blind? Are the values it gets curated/checked earlier?

Anyhow, don't get butt-hurt if I made a silly assumption or mistake. I'm ignorant. Just trying to peek at the code and learn a bit.

-Swift


Home | Main Index | Thread Index | Old Index