Skip to contentSkip to conversation

V4L/DVB: uninitialized variable in

PATCH New Dan Carpenter 1 participant 1 message May 22, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 V4L/DVB: uninitialized variable in

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.

drivers/staging/cx25821/cx25821-video.c +7 -5
index 791212c..56a7521 100644
@@ -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);
 }