Linux Media Controller development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: hans.verkuil@cisco.com
Cc: linux-media@vger.kernel.org
Subject: re: [media] tm6000: add support for control events and prio handling
Date: Thu, 7 Feb 2013 13:44:54 +0300	[thread overview]
Message-ID: <20130207104454.GA466@elgon.mountain> (raw)

Hello Hans Verkuil,

The patch 770056c47fbb: "[media] tm6000: add support for control
events and prio handling" from Sep 11, 2012, leads to the following
Smatch warning:
"drivers/media/usb/tm6000/tm6000-video.c:1462 __tm6000_poll()
	 error: potentially dereferencing uninitialized 'buf'."

drivers/media/usb/tm6000/tm6000-video.c
  1453          if (!is_res_read(fh->dev, fh)) {
  1454                  /* streaming capture */
  1455                  if (list_empty(&fh->vb_vidq.stream))
  1456                          return res | POLLERR;
  1457                  buf = list_entry(fh->vb_vidq.stream.next, struct tm6000_buffer, vb.stream);
  1458          } else if (req_events & (POLLIN | POLLRDNORM)) {
  1459                  /* read() capture */
  1460                  return res | videobuf_poll_stream(file, &fh->vb_vidq, wait);
  1461          }

If we don't hit either side of the if else statement then buf is
uninitialized.

  1462          poll_wait(file, &buf->vb.done, wait);
  1463          if (buf->vb.state == VIDEOBUF_DONE ||
  1464              buf->vb.state == VIDEOBUF_ERROR)
  1465                  return res | POLLIN | POLLRDNORM;
  1466          return res;

regards,
dan carpenter


             reply	other threads:[~2013-02-07 10:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-07 10:44 Dan Carpenter [this message]
2013-02-07 11:01 ` [media] tm6000: add support for control events and prio handling Hans Verkuil

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=20130207104454.GA466@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=hans.verkuil@cisco.com \
    --cc=linux-media@vger.kernel.org \
    /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