public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] V4L/DVB: uninitialized variable in
@ 2010-05-22 20:31 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2010-05-22 20:31 UTC (permalink / raw)
  To: kernel-janitors

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);
 }

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-05-22 20:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-22 20:31 [patch] V4L/DVB: uninitialized variable in Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox