staging: cx25821: avoid NULL pointer dereference
authorAlexander Beregalov <a.beregalov@gmail.com>
Thu, 7 Jan 2010 00:21:48 +0000 (03:21 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 4 Mar 2010 00:42:40 +0000 (16:42 -0800)
Assign dev only if fh is not NULL.

Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/cx25821/cx25821-audups11.c
drivers/staging/cx25821/cx25821-video.c

index 89c8fe2997fa75730f9498dcb73dd8ccc1b717d3..46c7f78bb972ed2f4785a102d3402b8944565fcf 100644 (file)
@@ -343,10 +343,11 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
                         struct v4l2_control *ctl)
 {
        struct cx25821_fh *fh = priv;
-       struct cx25821_dev *dev = fh->dev;
+       struct cx25821_dev *dev;
        int err;
 
        if (fh) {
+               dev = fh->dev;
                err = v4l2_prio_check(&dev->prio, &fh->prio);
                if (0 != err)
                        return err;
index 6e710ae067ad0bd258d88d439fc5d0343619e7b3..8cd3986d2e5c3de059a94b9050ba00f426e65ab8 100644 (file)
@@ -963,10 +963,11 @@ int cx25821_set_freq(struct cx25821_dev *dev, struct v4l2_frequency *f)
 int vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *f)
 {
        struct cx25821_fh *fh = priv;
-       struct cx25821_dev *dev = fh->dev;
+       struct cx25821_dev *dev;
        int err;
 
        if (fh) {
+               dev = fh->dev;
                err = v4l2_prio_check(&dev->prio, &fh->prio);
                if (0 != err)
                        return err;