All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: tiwai@suse.de
Cc: alsa-devel@alsa-project.org
Subject: Re: ALSA: timer: Handle disconnection more safely
Date: Fri, 22 Jan 2016 22:52:48 +0300	[thread overview]
Message-ID: <20160122195247.GA13742@mwanda> (raw)

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

             reply	other threads:[~2016-01-22 19:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-22 19:52 Dan Carpenter [this message]
2016-01-23  8:56 ` ALSA: timer: Handle disconnection more safely Takashi Iwai

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=20160122195247.GA13742@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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 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.