Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1342173 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2016-02-24 17:30 +0100 |
| Last post | 2016-02-24 17:50 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Arnd Bergmann <arnd@arndb.de> - 2016-02-24 17:30 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Takashi Iwai <tiwai@suse.de> - 2016-02-24 17:30 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Arnd Bergmann <arnd@arndb.de> - 2016-02-24 17:50 +0100
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-02-24 17:30 +0100 |
| Subject | Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer |
| Message-ID | <r5Ku6-76F-1@gated-at.bofh.it> |
On Wednesday 17 February 2016 10:35:40 Takashi Iwai wrote:
> On Wed, 17 Feb 2016 10:03:50 +0100,
> + const char *id;
> +#ifdef CONFIG_SND_JACK_INPUT_DEV
> + struct input_dev *input_dev;
> int registered;
> int type;
> - const char *id;
> char name[100];
> unsigned int key[6]; /* Keep in sync with definitions above */
> +#endif /* CONFIG_SND_JACK_INPUT_DEV */
> void *private_data;
> void (*private_free)(struct snd_jack *);
> };
I got a build error from this today, as the trace event tries to print
the jack "name" field. I've managed to get it to build again by printing
the "id" field in place of the "name". The name is normally assigned
from id in snd_jack_dev_register using
snprintf(jack->name, sizeof(jack->name), "%s %s",
card->shortname, jack->id);
but that code is not called here at all. My patch will slightly
alter the output as a consequence, but I don't know if this change
is critical or not.
Arnd
diff --git a/include/trace/events/asoc.h b/include/trace/events/asoc.h
index 317a1ed2f4ac..9130dd5a184a 100644
--- a/include/trace/events/asoc.h
+++ b/include/trace/events/asoc.h
@@ -231,13 +231,13 @@ TRACE_EVENT(snd_soc_jack_report,
TP_ARGS(jack, mask, val),
TP_STRUCT__entry(
- __string( name, jack->jack->name )
+ __string( name, jack->jack->id )
__field( int, mask )
__field( int, val )
),
TP_fast_assign(
- __assign_str(name, jack->jack->name);
+ __assign_str(name, jack->jack->id);
__entry->mask = mask;
__entry->val = val;
),
@@ -253,12 +253,12 @@ TRACE_EVENT(snd_soc_jack_notify,
TP_ARGS(jack, val),
TP_STRUCT__entry(
- __string( name, jack->jack->name )
+ __string( name, jack->jack->id )
__field( int, val )
),
TP_fast_assign(
- __assign_str(name, jack->jack->name);
+ __assign_str(name, jack->jack->id);
__entry->val = val;
),
[toc] | [next] | [standalone]
| From | Takashi Iwai <tiwai@suse.de> |
|---|---|
| Date | 2016-02-24 17:30 +0100 |
| Message-ID | <r5Ku6-76F-5@gated-at.bofh.it> |
| In reply to | #1342173 |
On Wed, 24 Feb 2016 17:18:58 +0100, Arnd Bergmann wrote: > > On Wednesday 17 February 2016 10:35:40 Takashi Iwai wrote: > > On Wed, 17 Feb 2016 10:03:50 +0100, > > + const char *id; > > +#ifdef CONFIG_SND_JACK_INPUT_DEV > > + struct input_dev *input_dev; > > int registered; > > int type; > > - const char *id; > > char name[100]; > > unsigned int key[6]; /* Keep in sync with definitions above */ > > +#endif /* CONFIG_SND_JACK_INPUT_DEV */ > > void *private_data; > > void (*private_free)(struct snd_jack *); > > }; > > I got a build error from this today, as the trace event tries to print > the jack "name" field. I've managed to get it to build again by printing > the "id" field in place of the "name". The name is normally assigned > from id in snd_jack_dev_register using > > snprintf(jack->name, sizeof(jack->name), "%s %s", > card->shortname, jack->id); > > but that code is not called here at all. My patch will slightly > alter the output as a consequence, but I don't know if this change > is critical or not. Thanks for catching this. Yes, your fix is correct. This must have been a wrong pick up when converting from the standalone hda jack to unified jack stuff. Could you send a proper patch for inclusion? Takashi > > Arnd > > diff --git a/include/trace/events/asoc.h b/include/trace/events/asoc.h > index 317a1ed2f4ac..9130dd5a184a 100644 > --- a/include/trace/events/asoc.h > +++ b/include/trace/events/asoc.h > @@ -231,13 +231,13 @@ TRACE_EVENT(snd_soc_jack_report, > TP_ARGS(jack, mask, val), > > TP_STRUCT__entry( > - __string( name, jack->jack->name ) > + __string( name, jack->jack->id ) > __field( int, mask ) > __field( int, val ) > ), > > TP_fast_assign( > - __assign_str(name, jack->jack->name); > + __assign_str(name, jack->jack->id); > __entry->mask = mask; > __entry->val = val; > ), > @@ -253,12 +253,12 @@ TRACE_EVENT(snd_soc_jack_notify, > TP_ARGS(jack, val), > > TP_STRUCT__entry( > - __string( name, jack->jack->name ) > + __string( name, jack->jack->id ) > __field( int, val ) > ), > > TP_fast_assign( > - __assign_str(name, jack->jack->name); > + __assign_str(name, jack->jack->id); > __entry->val = val; > ), > >
[toc] | [prev] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-02-24 17:50 +0100 |
| Message-ID | <r5KNs-7fP-15@gated-at.bofh.it> |
| In reply to | #1342175 |
On Wednesday 24 February 2016 17:25:42 Takashi Iwai wrote: > > Thanks for catching this. Yes, your fix is correct. This must have > been a wrong pick up when converting from the standalone hda jack to > unified jack stuff. > > Could you send a proper patch for inclusion? Ok, done. Arnd
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web