From: Takashi Iwai <tiwai@suse.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: alsa-devel@alsa-project.org, Takashi Sakamoto <o-takashi@sakamocchi.jp>
Subject: Re: ALSA: tons of false positives because of snd_ctl_find_id()
Date: Mon, 12 Feb 2018 14:20:09 +0100 [thread overview]
Message-ID: <s5hd11a5oqe.wl-tiwai@suse.de> (raw)
In-Reply-To: <20180202095728.4e2pfy2lwcprwpyb@mwanda>
On Fri, 02 Feb 2018 10:57:28 +0100,
Dan Carpenter wrote:
>
> 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.
Actually the value index is copied from the kctl->id before calling
the get and put callbacks. In snd_ctl_elem_read() and
snd_ctl_elem_write(), both call snd_ctl_build_ioff() just before
kctl->get() and kctl->put() calls. This overwrites both index and
numid fields with the correction of the offset.
Takashi
prev parent reply other threads:[~2018-02-12 13:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-02 8:29 ALSA: tons of false positives because of snd_ctl_find_id() Dan Carpenter
2018-02-02 9:07 ` Takashi Sakamoto
2018-02-02 9:57 ` Dan Carpenter
2018-02-12 13:20 ` Takashi Iwai [this message]
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=s5hd11a5oqe.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=dan.carpenter@oracle.com \
--cc=o-takashi@sakamocchi.jp \
/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