* Re: ALSA: timer: Handle disconnection more safely
@ 2016-01-22 19:52 Dan Carpenter
2016-01-23 8:56 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-01-22 19:52 UTC (permalink / raw)
To: tiwai; +Cc: alsa-devel
Hello Takashi Iwai,
This is a semi-automatic email about new static checker warnings.
The patch 230323dac060: "ALSA: timer: Handle disconnection more
safely" from Jan 21, 2016, leads to the following Smatch complaint:
sound/core/timer.c:1091 snd_timer_proc_read()
error: we previously assumed 'timer->card' could be null (see line 1084)
sound/core/timer.c
1083 list_for_each_entry(timer, &snd_timer_list, device_list) {
1084 if (timer->card && timer->card->shutdown)
^^^^^^^^^^^
New test.
1085 continue;
1086 switch (timer->tmr_class) {
1087 case SNDRV_TIMER_CLASS_GLOBAL:
1088 snd_iprintf(buffer, "G%i: ", timer->tmr_device);
1089 break;
1090 case SNDRV_TIMER_CLASS_CARD:
1091 snd_iprintf(buffer, "C%i-%i: ",
1092 timer->card->number, timer->tmr_device);
^^^^^^^^^^^^^^^^^^^
Old untested dereference. But maybe SNDRV_TIMER_CLASS_CARD implies
non-NULL?
1093 break;
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: ALSA: timer: Handle disconnection more safely
2016-01-22 19:52 ALSA: timer: Handle disconnection more safely Dan Carpenter
@ 2016-01-23 8:56 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2016-01-23 8:56 UTC (permalink / raw)
To: Dan Carpenter; +Cc: alsa-devel
On Fri, 22 Jan 2016 20:52:48 +0100,
Dan Carpenter wrote:
>
> Hello Takashi Iwai,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch 230323dac060: "ALSA: timer: Handle disconnection more
> safely" from Jan 21, 2016, leads to the following Smatch complaint:
>
> sound/core/timer.c:1091 snd_timer_proc_read()
> error: we previously assumed 'timer->card' could be null (see line 1084)
>
> sound/core/timer.c
> 1083 list_for_each_entry(timer, &snd_timer_list, device_list) {
> 1084 if (timer->card && timer->card->shutdown)
> ^^^^^^^^^^^
> New test.
This checks for all timer classes including the one that doesn't have
card object assigned.
> 1085 continue;
> 1086 switch (timer->tmr_class) {
> 1087 case SNDRV_TIMER_CLASS_GLOBAL:
> 1088 snd_iprintf(buffer, "G%i: ", timer->tmr_device);
> 1089 break;
> 1090 case SNDRV_TIMER_CLASS_CARD:
> 1091 snd_iprintf(buffer, "C%i-%i: ",
> 1092 timer->card->number, timer->tmr_device);
> ^^^^^^^^^^^^^^^^^^^
> Old untested dereference. But maybe SNDRV_TIMER_CLASS_CARD implies
> non-NULL?
Yes. So the current code is correct.
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-23 8:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-22 19:52 ALSA: timer: Handle disconnection more safely Dan Carpenter
2016-01-23 8:56 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.