All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: [patch] V4L/DVB: uninitialized variable in
Date: Sat, 22 May 2010 20:31:40 +0000	[thread overview]
Message-ID: <20100522203140.GQ22515@bicker> (raw)

The patch ffb4877ba0: "V4L/DVB: v4l2-common: simplify prio utility
functions" accidentally removed the "dev = fh->dev;" assignment.
Even before that change, we still could have passed a bogus "dev" pointer
to cx25821_set_freq() if "fh" was null.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/staging/cx25821/cx25821-video.c b/drivers/staging/cx25821/cx25821-video.c
index 791212c..56a7521 100644
--- a/drivers/staging/cx25821/cx25821-video.c
+++ b/drivers/staging/cx25821/cx25821-video.c
@@ -966,11 +966,13 @@ int cx25821_vidioc_s_frequency(struct file *file, void *priv, struct v4l2_freque
 	struct cx25821_dev *dev;
 	int err;
 
-	if (fh) {
-		err = v4l2_prio_check(&dev->prio, fh->prio);
-		if (0 != err)
-			return err;
-	}
+	if (!fh)
+		return -ENODEV;
+
+	dev = fh->dev;
+	err = v4l2_prio_check(&dev->prio, fh->prio);
+	if (0 != err)
+		return err;
 
 	return cx25821_set_freq(dev, f);
 }

                 reply	other threads:[~2010-05-22 20:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20100522203140.GQ22515@bicker \
    --to=error27@gmail.com \
    --cc=kernel-janitors@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 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.