Linux IIO development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: jic23@cam.ac.uk
Cc: linux-iio@vger.kernel.org
Subject: re: staging:iio:triggers introduce iio_trigger_ops to take const bits out of iio_trig_structure.
Date: Tue, 10 May 2016 11:03:04 +0300	[thread overview]
Message-ID: <20160510080304.GA5874@mwanda> (raw)

Hello Jonathan Cameron,

The patch d29f73db7910: "staging:iio:triggers introduce
iio_trigger_ops to take const bits out of iio_trig_structure." from
Aug 12, 2011, leads to the following static checker warning:

	drivers/iio/industrialio-trigger.c:376 iio_trigger_write_current()
	error: we previously assumed 'indio_dev->trig->ops' could be null (see line 367)

drivers/iio/industrialio-trigger.c
   360  
   361          if (trig && trig->ops && trig->ops->validate_device) {
                            ^^^^^^^^^
New check.

   362                  ret = trig->ops->validate_device(trig, indio_dev);
   363                  if (ret)
   364                          return ret;
   365          }
   366  
   367          indio_dev->trig = trig;
   368  
   369          if (oldtrig) {
   370                  if (indio_dev->modes & INDIO_EVENT_TRIGGERED)
   371                          iio_trigger_detach_poll_func(oldtrig,
   372                                                       indio_dev->pollfunc_event);
   373                  iio_trigger_put(oldtrig);
   374          }
   375          if (indio_dev->trig) {
   376                  iio_trigger_get(indio_dev->trig);
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Dereferenced inside the function without checking.

   377                  if (indio_dev->modes & INDIO_EVENT_TRIGGERED)
   378                          iio_trigger_attach_poll_func(indio_dev->trig,
   379                                                       indio_dev->pollfunc_event);
   380          }

regards,
dan carpenter

             reply	other threads:[~2016-05-10  8:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-10  8:03 Dan Carpenter [this message]
2016-05-14 17:21 ` staging:iio:triggers introduce iio_trigger_ops to take const bits out of iio_trig_structure Jonathan Cameron

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=20160510080304.GA5874@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=jic23@cam.ac.uk \
    --cc=linux-iio@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