[alsa-devel] ALSA: tons of false positives because of snd_ctl_find_id()

Dan Carpenter dan.carpenter at oracle.com
Fri Feb 2 10:57:28 CET 2018


On Fri, Feb 02, 2018 at 06:07:14PM +0900, Takashi Sakamoto wrote:
> 
> In a design of ALSA control core, each element can be pointed according
> to data of 'struct snd_ctl_elem_id'. There're two independent ways to
> indicate arbitrary element:
>  1. by 'numerical ID' (.numid)
>  2. by a combination of 'interface' (.iface), 'device' (.device),
>     'sub device' (.subdevice), 'name' (.name) and 'index' (.index).
> 
> For our information, in ALSA control core, some elements with the same
> attributes are managed by data of 'struct snd_kcontrol'. I call it as
> 'element set'. The value of '.index' represents offset from the first
> element in the element set for a target element.
> 
> I don't get your concern clearly. But it's my pleasure that the above
> information will help you if you missed the two ways.
> 

Right.  Thanks.  I understood all that...

I've actually figured out a hack that will probably work fine to fix my
issue.  Smatch provides a way to hand edit the cross function DB:
http://repo.or.cz/smatch.git/blob/HEAD:/smatch_data/db/fixup_kernel.sh
I can probably solve this by adding a few lines of code to that file.
I'm testing it now.

What I was trying to say was even though we don't need to check .index
since we're not using it, it would simplify static analysis if we would
would set it to zero.  It shouldn't hurt anything since we're not going
to use it.

Anyway, leave it for now because I've got this easier hack around.

regards,
dan carpenter




More information about the Alsa-devel mailing list