]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[media] ngene: preventing dereferencing a NULL pointer
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 28 Apr 2015 13:02:07 +0000 (10:02 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Thu, 30 Apr 2015 16:33:06 +0000 (13:33 -0300)
As reported by smatch:
drivers/media/pci/ngene/ngene-core.c:1529 init_channel() error: we previously assumed 'chan->fe' could be null (see line 1521)

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/pci/ngene/ngene-core.c

index e29bc3af4bafe3ad25a8e059c9d0697b12940874..1b92d836a564fd364862acab2e761602e62744bd 100644 (file)
@@ -1526,10 +1526,12 @@ static int init_channel(struct ngene_channel *chan)
        if (chan->fe2) {
                if (dvb_register_frontend(adapter, chan->fe2) < 0)
                        goto err;
-               chan->fe2->tuner_priv = chan->fe->tuner_priv;
-               memcpy(&chan->fe2->ops.tuner_ops,
-                      &chan->fe->ops.tuner_ops,
-                      sizeof(struct dvb_tuner_ops));
+               if (chan->fe) {
+                       chan->fe2->tuner_priv = chan->fe->tuner_priv;
+                       memcpy(&chan->fe2->ops.tuner_ops,
+                              &chan->fe->ops.tuner_ops,
+                              sizeof(struct dvb_tuner_ops));
+               }
        }
 
        if (chan->has_demux) {