[media] lmedm04: Fix possible NULL pointer dereference
authorSyam Sidhardhan <syamsidhardh@gmail.com>
Sun, 24 Feb 2013 21:47:18 +0000 (18:47 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 18 Mar 2013 19:34:15 +0000 (16:34 -0300)
Check for (adap == NULL) has to done before accessing adap.

Signed-off-by: Syam Sidhardhan <s.syam@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/usb/dvb-usb-v2/lmedm04.c

index f30c58cecbba4d0e597e3ffd55be07c6cebf8065..96804be0fffec49b638a726234dcd1ddc68f63be 100644 (file)
@@ -1241,10 +1241,13 @@ static int lme2510_get_stream_config(struct dvb_frontend *fe, u8 *ts_type,
                struct usb_data_stream_properties *stream)
 {
        struct dvb_usb_adapter *adap = fe_to_adap(fe);
-       struct dvb_usb_device *d = adap_to_d(adap);
+       struct dvb_usb_device *d;
 
        if (adap == NULL)
                return 0;
+
+       d = adap_to_d(adap);
+
        /* Turn PID filter on the fly by module option */
        if (pid_filter == 2) {
                adap->pid_filtering  = 1;